workbook.createSort(options)
Method Description |
Creates a sort, which includes indicators for sorting in ascending order, case sensitivity, sort locale, and whether nulls should be placed last. |
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 |
---|---|---|---|
|
boolean |
optional |
Indicator for sorting in ascending order. If set to false, sorting is done in descending order. The default value is true (sort in ascending order). |
|
boolean |
optional |
Indicator that the sort should consider case sensitivity. |
|
optional |
The option for locale specific sorting. |
|
|
boolean |
optional |
Indicator that the sort should place null items last. The default of this parameter is the value of the ascending parameter (for example, if |
Errors
Error Code |
Thrown If |
---|---|
|
The value specified 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 a default Sort (no options specfified)
var mySort = workbook.createSort({});
// Create a custom descending Sort
var mySort = workbook.createSort({
ascending: false,
caseSensitive: true,
nullsLast: true,
locale: query.SortLocale.US_EN
});
...
// Add additional code