Edit

Sort (tabDelimTable, sortColumn[, sortType][, descending] [,skipfirst])

Result Type: A tab/newline delimited table such as is returned from Analyse()

Definition: Sorts a tab/newline delimited table. sortColumn is the column number to sort by, where 1 = leftmost column, and a negative value counts from the right (i.e -1 = rightmost column). If descending is 0, the table is sorted in ascending order, otherwise it is sorted in descending. For an alphabetic sort, set sortType to SortCaseSensitive or SortCaseInsensitive; to treat the column as numeric, set sortType to SortNumeric. If skipfirst is true, the first row of the table is not sorted (i.e. first row stays at the top of the table—use when the table has headings).

Note  In MoneyWorks versions prior to 9.2, the sortType parameter was a boolean with true (1) indicating numeric and 0 indicating case insentive alphabetic. Case insensitivity applies only to the ASCII codepoint range.

Examples: If MyTable is “A\t1\t2\nB\t3\t4\n\C\t5\t6”, as shown below:

A12
B34
C56

Sort(MyTable, 2, 1, 1) returns

C56
B34
A12

Sort(MyTable, 2, 1, 1, 1) returns

A12
C56
B34

i.e. first row was heading.

See Also:

CreateTable: Create an empty accumulator table

TableAccumulate: Accumulate numeric column data for a key

TableAccumulateColumn: Accumulate data in one column for a key

TableFind: Look up a key in the table

TableGet: Extract data for a key or index found with TableFind

Transpose: Transpose a tabular delimited string