workbook.createSortDefinition(options)
Method Description |
Creates a sort definition. A sort definition is used to specify sorting for a pivot or pivot axis. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
required |
The selector for the sort definition. |
|
|
required |
The sort order for the sort definition. |
Errors
Error Code |
Thrown If |
---|---|
|
The value set for the |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/workbook Module Script Samples. Also see Full scripts in the Tutorial: Creating a Workbook Using the Workbook API topic.
// Add additional code
...
// Create an AllSubNodesSelector SortDefinition sorted by Measure
var mySort = workbook.createSortDefinition({
selector: workbook.createAllSubNodesSelector(),
sortBys: [myMeasureSort]
});
// Create a DimensionSelector SortDefinition sorted by Measure
var mySort = workbook.createSortDefinition({
selector: myDimensionSelector,
sortBys: [myMeasureSort]
});
// Create a PathSelector SortDefinition sorted by Dimension
var mySort = workbook.createSortDefinition({
selector: myPathSelector,
sortBys: [myDimensionSort]
});
...
// Add additional code