workbook.Sort
Object Description |
A sort object which is used when you create a table column, a dimension sort, or a measure sort. Use workbook.createSort(options) to create this object. A sort object is used as a parameter in the workbook.createDimensionSort(options), workbook.createMeasureSort(options), workbook.createSortByDataDimensionItem(options), and workbook.createTableColumn(options) methods. |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2020.2 |
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
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