PageRange Object Members for Search Management in NetSuite

Understand the PageRange object members in the N/search module for effective pagination management in NetSuite.

·2 min read·View Oracle Docs

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 NameReturn TypeDescription
PageRange.compoundLabelstring (read-only)A human-readable label indicating the start and end of the range.
PageRange.indexnumber (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:

  1. Creating a Search: When creating a search query, define pagination parameters to generate a PagedData object that can utilize PageRange to manage results.
  2. Navigating Results: Utilize the index property 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:

javascript
1var search = require('N/search');
2var paginatedSearch = search.create({
3 type: search.Type.TRANSACTION,
4 // Define any additional search options
5});
6var pagedData = paginatedSearch.runPaged({
7 pageSize: 100
8});
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 PageRange object is crucial for pagination in searches.
  • Important properties include compoundLabel for user-friendly navigation and index for tracking current pagination.
  • Use the PageRange within the context of PagedData to 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?
The PageRange object is part of the N/search module and is used for managing pagination in search queries within standard NetSuite.
What permissions are required to use the PageRange object in a search script?
The article does not specify permissions, but using the N/search module typically requires SuiteScript privileges and access to search records in NetSuite.
Can the PageRange object be used in unauthenticated contexts within SuiteScript?
No, the N/search module, which includes the PageRange object, is only operational in authenticated client-side contexts.
Will using the PageRange object affect existing search scripts in NetSuite?
Using the PageRange object is specifically for handling pagination and should not affect existing search scripts unless pagination management is added to them.
Source: PageRange 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 Searches

View all Searches articles →