Sorting Tables

The table class can be the target of the sort command, which takes as its required parameter, the column to be used as the sorting reference.

sort  : Sort the rows of the table.

sort table

by column : The column to sort by.

[ direction ascending/‌descending ] : The location at which to insert the object.

[ in rows range ] : Limit the sort to the specified rows.

The command includes two optional parameters: one for determining the sorting direction; and another for limiting the sort to the indicated rows.

For example, the table shown below is an attendance table:

sort-table-01

To sort the rows of the table based on the column of containing the names, pass a reference to the first column as the direct parameter of the sort command, and indicate the desired sorting order using the optional direction parameter:

tell thisTable to sort by column 1 direction ascending

The table is then sorted:

sort-table-02

TOP | CONTINUE