SortByMeasure Object for Workbook Sorting in SuiteScript
The SortByMeasure object enables sorting by specific measures in SuiteScript, providing enhanced analytics capabilities.
The SortByMeasure object is crucial for developers creating sorts based on measures in NetSuite workbooks. This object allows you to define the sorting behavior of data within reports, creating a more dynamic and insightful analytical environment.
What Members Are Available in SortByMeasure?
The SortByMeasure object comprises several members, each serving specific purposes in sorting functionality. Below is a table detailing these members:
| Member | Type | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
SortByMeasure.measure | workbook.CalculatedMeasure <br> workbook.DataMeasure | workbook.CalculatedMeasure <br> workbook.DataMeasure | Server scripts | The measure for the sort. |
SortByMeasure.otherAxisSelector | workbook.DescendantorSelfNodesSelector <br> workbook.PathSelector <br> workbook.DimensionSelector | workbook.DescendantorSelfNodesSelector <br> workbook.PathSelector <br> workbook.DimensionSelector | Server scripts | The selector for the axis not defined in the sort. |
SortByMeasure.sort | workbook.Sort | workbook.Sort | Server scripts | The sort to use for ordering the data. |
How Do You Create a SortByMeasure Object?
To instantiate a SortByMeasure object, utilize the workbook.createSortByMeasure(options) method. Below is a sample syntax illustrating how this can be achieved:
1// Example of creating a SortByMeasure object2var mySortByMeasure = workbook.createSortByMeasure({3 measure: myWorkbookMeasure, // previously created workbook.Measure object4 otherAxisSelector: myAxisSelector, // previously created selector object5 sort: mySort // previously created workbook.Sort object6});Supported Script Types
The SortByMeasure object is available for use in Server Scripts. Developers may explore more about script types in the SuiteScript 2.x documentation.
Error Handling
Developers should be aware of the potential errors that may arise when utilizing the SortByMeasure object. For instance, if the SortByMeasure.measure property receives a value that is not a valid workbook.CalculatedMeasure or workbook.DataMeasure, the system will throw a WRONG_PARAMETER_TYPE error. This feature ensures that only the correct types are employed, enhancing robustness in script execution.
Summary
The SortByMeasure object is instrumental when organizing the data in workbooks, empowering developers to create more effective and user-friendly reports while leveraging defined measures for precise analytics. Being versed in how to properly implement and manage this object is essential for maximizing the functionality of SuiteScript in NetSuite workbooks.
Key Takeaways
- The SortByMeasure object is vital for defining sorts by measures in NetSuite workbooks.
- Three key members are utilized:
measure,otherAxisSelector, andsort. - Correct parameter types are critical to avoid errors during execution.
- This object is designed for Server Scripts within SuiteScript.
Frequently Asked Questions (4)
What types of measures can be used with the SortByMeasure object?
Is the SortByMeasure object available for client scripts or only server scripts?
What error might be thrown if incorrect types are used with the SortByMeasure object?
What method should be used to create a SortByMeasure object in SuiteScript?
Was this article helpful?
More in SuiteAnalytics
- Class, Department, Location Features in NetSuite 2026.1
Class, Department, and Location features enhance financial processes in NetSuite 2026.1 for improved insights and reporting.
- New HTML Formulas in Search for NetSuite 2025.1
New HTML Formulas in Search introduced in NetSuite 2025.1 enhances security for saved searches. Starting in NetSuite 2025.1, the HTML Formulas in Search feature
- Export Pivot Tables to Excel in NetSuite 2024.2
Export Workbook pivot tables to Excel XLSX format starting with NetSuite 2024.2, enhancing data analysis and reporting capabilities.
- Consolidated Reports and SuiteQL in NetSuite 2026.1
Consolidated reports and SuiteQL enhance data access in NetSuite 2026.1. Discover key integration features.
Advertising
Reach SuiteAnalytics Professionals
Put your product in front of NetSuite experts who work with SuiteAnalytics every day.
Sponsor This Category