MoneyWorks Manual
Sort (tabDelimTable, sortColumn[, numeric][, 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 numeric to 0, otherwise the table will be sorted numerically. If skipfirst is non-zero, 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).
Examples: If MyTable is “A\t1\t2\nB\t3\t4\n\C\t5\t6”, as shown below:
A | 1 | 2 |
B | 3 | 4 |
C | 5 | 6 |
Sort(MyTable, 2, 1, 1)
returns
C | 5 | 6 |
B | 3 | 4 |
A | 1 | 2 |
Sort(MyTable, 2, 1, 1, 1)
returns
A | 1 | 2 |
C | 5 | 6 |
B | 3 | 4 |
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