SortDefinition Object Members
Explore SortDefinition object members in SuiteScript, including key properties like selector and sortBys for workbook functionality.
TL;DR
The SortDefinition object in SuiteScript provides essential properties for defining sorting criteria in workbooks, including selector and sortBys. Understanding these members is vital for effectively leveraging sorting within pivot axes.
What is the SortDefinition Object?
The SortDefinition object is used to create sorting dimensions within workbooks, enhancing data manipulation and presentation. It allows you to define how data is sorted when creating pivot axes through methods such as workbook.createSortDefinition(options).
SortDefinition Object Members
Properties
The following properties are part of the SortDefinition object:
| Property Name | Type | Description |
|---|---|---|
SortDefinition.selector | workbook.DimensionSelector, workbook.PathSelector | The selector that determines the criterion for sorting. |
SortDefinition.sortBys | Array of workbook.SortByDataDimensionItem, workbook.SortByMeasure | Defines the sorting order. |
Supported Script Types
The SortDefinition object is specifically designed to be used within server scripts.
Example Usage
Here's how to create an instance of the SortDefinition object in your SuiteScript:
1// Add additional code2...3var mySortDefinition = workbook.createSortDefinition({4 selector: myDimensionSelector,5 sortBys: [myDimensionSort]6});7...8// Add additional codeThis example illustrates how to define your sorting criteria effectively using the SortDefinition object, which can then be utilized in methods that require sorting parameters, such as when creating a pivot axis.
Who This Affects
- Developers: Those implementing workbooks in SuiteScript will directly benefit from understanding the SortDefinition members.
- Administrators: Users managing reports and dashboards can leverage sorting functionalities to enhance data visibility.
Key Takeaways
- The SortDefinition object includes essential properties for sorting in workbooks.
selectorandsortBysare vital for customizing sorting behavior.- This object is used within server scripts, enhancing the flexibility of data manipulations in NetSuite.
Frequently Asked Questions (4)
What types of selectors can be used with the SortDefinition object in SuiteScript?
Is the SortDefinition object applicable to all types of scripts within NetSuite?
How do you define sorting order using the SortDefinition object?
Can the SortDefinition object be used for enhancing data visibility in dashboards?
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.
