sortDataset
This function is used by Ignition's Expression language.
Description
Returns a new dataset based on the rows in the given dataset. Sort order is natural if the Class of keyColumn implements java.lang.Comparable, otherwise sorting is done by the toString() value.
Syntax
sortDataset(dataset, colIndex[, ascending])
Parameters
DataSet dataset - The starting dataset.
int colIndex - The index of the column to sort on.
Bool ascending - Optional. A flag indicating whether or not to sort ascending.
Results
- DataSet - A sorted dataset
Syntax
sortDataset(dataset, colName[, ascending])
Parameters
DataSet dataset - The starting dataset.
int colName- The name of the column to sort on.
Bool ascending - Optional. A flag indicating whether or not to sort ascending.
Results
- DataSet - A sorted dataset
Examples
Code Snippet
sortDataset(dataset, 0, true) // returns a Dataset sorted ascending on column 0.
Code Snippet
sortDataset(dataset, "Column 1", false) // returns a Dataset sorted descending on the column named "Column 1".