query.PageRange
Object Description |
The range of query results for a page. |
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2018.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
...
var myCustomerQuery = query.create({
type: query.Type.CUSTOMER
});
myCustomerQuery.columns = [
myCustomerQuery.createColumn({
fieldId: 'entityid'
}),
myCustomerQuery.createColumn({
fieldId: 'firstname'
}),
myCustomerQuery.createColumn({
fieldId: 'email'
})
];
var myPagedResults = myCustomerQuery.runPaged({
pageSize: 10
});
// Fetch results using an iterator
var iterator = myPagedResults.iterator();
iterator.each(function(resultPage) {
var currentPage = resultPage.value;
var currentPageRange = currentPage.pageRange;
log.debug(currentPageRange.size);
return true;
});
// Alternatively, fetch results using a loop
for (var i = 0; i < myPagedResults.pageRanges.length; i++) {
var currentPage = myPagedResults.fetch(i);
var currentPageRange = currentPage.pageRange;
log.debug(currentPageRange.size);
}
...
// Add additional code