PageRange Object Members for Search Management in NetSuite
Understand the PageRange object members in the N/search module for effective pagination management in NetSuite.
The PageRange object in the N/search module of NetSuite is essential for managing pagination when querying large datasets. It allows developers to define the page range for a paginated query, optimizing the process of retrieving search results efficiently.
What is the PageRange Object?
The search.PageRange object encapsulates two primary properties which are vital for pagination:
PageRange Properties
| Property Name | Return Type | Description |
|---|---|---|
PageRange.compoundLabel | string (read-only) | A human-readable label indicating the start and end of the range. |
PageRange.index | number (read-only) | The index of the current page range. |
How to Use the PageRange Object
The PageRange object typically comes into play within the context of paginated searches. Use the properties of the PageRange to navigate between pages of results efficiently:
- Creating a Search: When creating a search query, define pagination parameters to generate a
PagedDataobject that can utilizePageRangeto manage results. - Navigating Results: Utilize the
indexproperty to determine the current range’s position, allowing for easy access to previous or next pages of data.
Example Usage
Although the specific methods would depend on the overall search context, a typical usage scenario may look like this:
1var search = require('N/search');2var paginatedSearch = search.create({3 type: search.Type.TRANSACTION,4 // Define any additional search options5});6var pagedData = paginatedSearch.runPaged({7 pageSize: 1008});9 10pagedData.pageRanges.forEach(function (pageRange) {11 console.log('Page Index: ' + pageRange.index);12 console.log('Label: ' + pageRange.compoundLabel);13});Important Consideration
The N/search module is only operational in authenticated client-side contexts. For further information, refer to SuiteAnswers regarding outbound HTTP in unauthenticated contexts.
Related Topics:
- Search Object Members
- PagedData Object Members
Understanding the PageRange object and its properties enhances your ability to handle large search datasets effectively, ensuring applications remain performant and user-friendly.
Key Takeaways
- The
PageRangeobject is crucial for pagination in searches. - Important properties include
compoundLabelfor user-friendly navigation andindexfor tracking current pagination. - Use the
PageRangewithin the context ofPagedDatato manage large datasets effectively.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Does the PageRange object apply to WMS, standard NetSuite, or both?
What permissions are required to use the PageRange object in a search script?
Can the PageRange object be used in unauthenticated contexts within SuiteScript?
Will using the PageRange object affect existing search scripts in NetSuite?
Was this article helpful?
More in Searches
- Search for Sublist Line Fields With Dynamic Tables in NetSuite
Learn how to optimize search queries for sublist line fields in NetSuite using dynamic tables and SuiteQL.
- Filter Object Members in NetSuite SuiteScript
Gain insights into the Filter Object Members of the N/search module in NetSuite SuiteScript. Learn how to create and configure filters effectively.
- Search Column Syntax for SuiteScript 2.x in NetSuite
Search column syntax in SuiteScript 2.x allows encapsulation of fields in NetSuite searches, enhancing data retrieval capabilities.
- PagedData Object Members in NetSuite SuiteScript 2.0
PagedData provides efficient pagination for search results in SuiteScript, enabling effective handling of large data sets.
Advertising
Reach Searches Professionals
Put your product in front of NetSuite experts who work with Searches every day.
Sponsor This Category