Query.runPaged()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Executes the query and returns a query.PagedData object that represents the paged query results. You can iterate over this object to obtain each page of query results.

For paged queries, the maximum number of result rows per page is 1000. The minimum number of result rows per page is 5, except for the last page in the result set (because the last page may include fewer than 5 results).

Returns

query.PagedData

Supported Script Types

Client and server scripts

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

Governance

10 units

Module

N/query Module

Parent Object

query.Query

Sibling Object Members

Query Object Members

Since

2018.1

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.pageSize

string

optional

The size of each page in the query results.

The default page size is 50 results per page.

options.customScriptId

string

optional

A unique identifier used for potential performance issues in a query.

If your query produces performance issues, the custom script ID identifies where the update will need to occur.

This ID can also be used as a precaution to speed up performance fixes, if necessary.

Note:

The Script ID must be unique or the performance enhancements will affect each query with the same customScriptID.

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
...
var myTransactionQuery = query.create({ type: query.Type.TRANSACTION
}); var myEntityJoin = myTransactionQuery.autoJoin({ fieldId: 'entity'
}); myTransactionQuery.columns = [ myEntityJoin.createColumn({ name: 'subsidiary' })
]; myTransactionQuery.sort = [ myTransactionQuery.createSort({ column: myTransactionQuery.columns[0], ascending: false })
]; var results = myTransactionQuery.runPaged({ pageSize: 10, customScriptId: 'myCustomScriptId'
}); // Use the count property to count the
// search results easily
var resultCount = myTransactionQuery.runPaged({ pageSize: 10
}).count;
...
// Add additional code 

          

Related Topics

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

General Notices