Query.toSuiteQL()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Converts this query.Query object to its corresponding SuiteQL representation.

This method returns a query.SuiteQL object that represents the same query as the original query.Query object. This object includes the SuiteQL.columns, SuiteQL.params, SuiteQL.query, and SuiteQL.type properties. You can run the query using SuiteQL.run(), or you can run the query as a paged query using SuiteQL.runPaged(options).

Important:

The resulting SuiteQL query string (contained in the SuiteQL.query property) does not include any aliases you set on query result columns in the original query.Query object. For more information about aliases, see Column.alias.

For more information and examples of using SuiteQL in the N/query module, see SuiteQL in the N/query Module. For more information about SuiteQL in general, see SuiteQL.

Returns

query.SuiteQL

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/query Module

Parent Object

query.Query

Sibling Object Members

Query Object Members

Since

2020.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
// myQuery is an existing query.Query object
var mySuiteQLQuery = myQuery.toSuiteQL();

var results = mySuiteQLQuery.run();
...
// Add additional code 

          

Related Topics

query.Query
N/query Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices