ResultSet Object Members

Explore ResultSet object members in SuiteScript, enabling effective handling of search results in NetSuite applications.

·2 min read·View Oracle Docs

The ResultSet object in the N/search module allows developers to manage and process search results effectively, enabling seamless interaction with large datasets. This object provides essential methods and properties to iterate through sets of search results, making it highly beneficial for applications requiring data analysis or duplication checks.

What is the ResultSet Object?

The ResultSet object encapsulates a collection of search results returned by the Search.run() method. It allows developers to perform operations on the results returned from on-demand or saved searches created using the N/search module.

ResultSet Object Members

The ResultSet object includes the following notable members:

Member TypeNameReturn TypeSupported Script TypesDescription
MethodResultSet.each(callback)voidClient and server scriptsInvokes a developer-defined function for each row in the search results, processing up to 4000 results at a time.
MethodResultSet.getRange(options)search.Result[]Client and server scriptsRetrieves a slice of search results, providing an array of Result objects.
PropertyResultSet.columnssearch.Column[]Client and server scriptsRepresents the columns included in the search results, allowing access to column definitions.

The ability to paginate and filter search results through the ResultSet object is crucial for performance optimization when dealing with large sets of data.

Practical Use Cases

  • Iterating through Results: Use the each method to process each result during a search operation.
  • Fetching Specific Ranges: Utilize getRange to obtain only the relevant slices of data needed for particular computations or displays.

Important Considerations

  • The N/search module and its associated methods, including the ResultSet object, are not functional in unauthenticated client-side contexts. Ensure that you operate within authenticated environments to utilize these tools effectively.

By leveraging the ResultSet object, developers can efficiently manage large sets of data retrieved from NetSuite searches, enhancing both performance and user experience in applications.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The ResultSet object is essential for managing search results in NetSuite.
  • It provides methods for iterating through up to 4000 results at a time.
  • Use getRange to obtain specific result slices as needed.
  • The N/search module requires authenticated contexts to function correctly.

Frequently Asked Questions (4)

Can the ResultSet object be used in unauthenticated client-side scripts?
No, the N/search module, including the ResultSet object, requires authenticated contexts to function correctly. It is not available in unauthenticated client-side scripts.
How does the ResultSet.each method handle large datasets?
The ResultSet.each method processes each result up to 4000 results at a time, allowing developers to efficiently iterate through large datasets returned by a search operation.
What is the function of the ResultSet.getRange method?
The getRange method retrieves a specific slice of search results, returning an array of Result objects, which helps in processing subsets of data for calculations or display purposes.
What types of scripts support the ResultSet object members?
The ResultSet object members are supported in both client and server scripts, allowing for flexibility across different scripting environments in NetSuite applications.
Source: ResultSet 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 General

View all General articles →