workbook.Sort
Note:
The content in this help topic applies to SuiteScript 2.x.
Object Description |
A sort. A sort is used when you create a table column, a dimension sort, or a measure sort. You can create a sort using workbook.createSort(options). |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2020.2 |
Syntax
Important:
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.
// Add additional code
...
// Create a default Sort
var mySort = workbook.createSort({});
// Create a custom descending Sort
var mySort = workbook.createSort({
ascending: false,
caseSensitive: true,
nullsLast: true,
locale: query.SortLocale.US_EN
});
// View a workbook.Sort used in a TableDefinition
var myWorkbook = workbook.load ({
id: myWorkbookId
});
// Note that some Sort properties may be empty/null based on the loaded workbook
var mySort = myWorkbook.tableDefinitions[0].columns[0].sort;
log.audit({
title: 'Sort.ascending = ',
details: mySort.ascending
});
log.audit({
title: 'Sort.caseSensitive = ',
details: mySort.caseSensitive
});
log.audit({
title: 'Sort.locale = ',
details: mySort.locale
});
log.audit({
title: 'Sort.nullsLast = ',
details: mySort.nullsLast
});
...
// Add additional code