PagedData Object Members in SuiteScript 2.0
PagedData object in SuiteScript 2.0 offers methods and properties for handling paged query results efficiently.
The PagedData object in SuiteScript 2.0 is essential for developers managing paged query results, providing a comprehensive set of methods and properties to streamline data retrieval.
What is the PagedData Object?
The PagedData object encapsulates a set of paged query results, allowing developers to work with extensive datasets effectively. This object can be created using the Query.runPaged(options) or Query.runPaged.promise(options) methods. Each call can return up to 1000 results per page, streamlining the handling of large data results in NetSuite.
What Are PagedData Object Members?
The PagedData object includes various methods and properties designed for efficient data manipulation. Below is a summary of these members:
Methods
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
PagedData.iterator() | Iterator | Client and server scripts | Standard SuiteScript 2.0 object for iterating through results. |
PagedData.fetch(options) | query.Page | Client and server scripts | Retrieves a page in the set of pages included in the PagedData object. |
PagedData.fetch.promise(options) | Promise Object | Client and server scripts | Asynchronously retrieves a page in the set of pages included in the PagedData object. |
Properties
| Property Name | Type | Description |
|---|---|---|
PagedData.count | number (read-only) | The total number of paged query results. |
PagedData.pageRanges | query.PageRange[] | An array of page ranges for the set of paged query results. |
PagedData.pageSize | number (read-only) | The number of query result rows per page. |
Example Usage
To use the PagedData object effectively, you can set up a paginated query as follows:
1var myCustomerQuery = query.create({2 type: query.Type.CUSTOMER3});4myCustomerQuery.columns = [5 myCustomerQuery.createColumn({ fieldId: 'entityid' }),6 myCustomerQuery.createColumn({ fieldId: 'firstname' }),7 myCustomerQuery.createColumn({ fieldId: 'email' })8];9var myPagedResults = myCustomerQuery.runPaged({ pageSize: 10 });10 11// Fetch results using an iterator12var iterator = myPagedResults.iterator();13iterator.each(function(resultPage) {14 var currentPage = resultPage.value;15 var currentPagedData = currentPage.pagedData;16 log.debug(currentPage.pageRange.size);17 return true;18});In this example, a customer query is defined, executed, and results are iterated using the iterator() method of the PagedData object.
Who This Affects
This information is crucial for:
- Developers: Who need to handle paged data efficiently in their scripts.
- Administrators: Overseeing data management processes that involve paged queries.
Key Takeaways
- The PagedData object is vital for managing large datasets in SuiteScript 2.0.
- It includes methods for synchronous and asynchronous data retrieval.
- The object supports read-only properties for understanding query results.
Frequently Asked Questions (4)
How do I create a PagedData object in SuiteScript 2.0?
What is the maximum number of query results returned per page in PagedData?
Can I use the PagedData methods in both client and server scripts in SuiteScript 2.0?
What does the PagedData count property represent?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
