Page Object Members for Query in SuiteScript

Maximize suite scripting efficiency with Page Object Members, which provide real-time access to paged query results and navigation properties.

·2 min read·View Oracle Docs

The Page Object Members in SuiteScript allow developers to manage query results effectively through a paginated interface. This feature is integral for optimizing data retrieval and rendering in NetSuite solutions.

What Are Page Object Members?

Page Object Members are properties available for a query.Page object, designed to facilitate efficient handling of paged query results. Each member serves a specific purpose, providing access to different aspects of the data contained within the page.

Page Object Members Overview

The following table summarizes the available members for a Page object:

Member NameTypeSupported Script TypesDescription
Page.dataquery.ResultSet (read-only)Client and server scriptsContains the query results for the current page.
Page.isFirstboolean (read-only)Client and server scriptsIndicates if this is the first page of the paged query results.
Page.isLastboolean (read-only)Client and server scriptsIndicates if this is the last page of the paged query results.
Page.pagedDataquery.PagedData (read-only)Client and server scriptsRepresents the set of paged query results for this page.
Page.pageRangequery.PageRange (read-only)Client and server scriptsDetails the range of query results for this page.

How to Use Page Object Members

Using Page Object Members can standardize and streamline data retrieval in SuiteScript.

Example Code Snippet

Here’s a sample syntax demonstrating how to utilize Page Object Members within a SuiteScript context:

suitescript
1// Example of working with Page Object Members
2var myCustomerQuery = query.create({
3 type: query.Type.CUSTOMER
4});
5myCustomerQuery.columns = [
6 myCustomerQuery.createColumn({ fieldId: 'entityid' }),
7 myCustomerQuery.createColumn({ fieldId: 'firstname' }),
8 myCustomerQuery.createColumn({ fieldId: 'email' })
9];
10var myPagedResults = myCustomerQuery.runPaged({ pageSize: 10 });
11
12// Fetching results using an iterator
13var iterator = myPagedResults.iterator();
14iterator.each(function(resultPage) {
15 var currentPage = resultPage.value;
16 log.debug(currentPage.pageRange.size);
17 return true;
18});
19
20// Alternatively, using a loop
21for (var i = 0; i < myPagedResults.pageRanges.length; i++) {
22 var currentPage = myPagedResults.fetch(i);
23 log.debug(currentPage.pageRange.size);
24}

Who This Affects

  • Developers: Working with SuiteScript for data retrieval.
  • Administrators: Implementing and maintaining data management scripts.

Key Takeaways

  • Page Object Members represent a structured way to access paged query results in SuiteScript.
  • Each member plays a crucial role in manipulating and retrieving query results efficiently.
  • Understanding these members can greatly enhance script performance and data handling capabilities.

Frequently Asked Questions (4)

Which script types support the use of Page Object Members?
Page Object Members are supported in both client and server scripts in SuiteScript.
How can I determine if a page in a paginated query is the first or last page?
You can use the `Page.isFirst` and `Page.isLast` boolean members to check if a page is the first or last in the paginated query results.
What is the role of the `Page.pagedData` member in paginated queries?
The `Page.pagedData` member represents the set of paged query results for the current page, allowing you to access the entire dataset effectively.
Is it possible to iterate through all pages of a paged query using Page Object Members?
Yes, you can iterate through all pages of a paged query using an iterator to access each page's `Page.data` and other properties like `Page.pageRange`.
Source: Page Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →