You are here: Features > Action Events > Sort table rows

Sort Table Rows Action

Event Function: TableSort

The Sort Table Row action allows the rows in a specified table to be sorted by the method indicated. Header and total rows can be excluded from the sort.

Using the Events tab

Under Enter Example

Run Skip Condition

If desired, enter skip conditions for the event. When the "Run Skip Condition" is evaluated to be true, the action is not performed.

 

Table Name

The table label of the table to be sorted. Data must be entered as there is no default.

"ABC"

Order

"Ascending"

"Descending"

"Manual"

"Ascending" Ascending Order

Sort Column 1

Column of cells to sort by.

2

Sort Column 2

Optional second sort key to sort by. The default is 0.

3

Skip first rows

Do not include this many rows at the table beginning in sorting. Defaults to zero so that no rows skip.

2

Skip last rows

Do not include this many rows at the table end in sorting. Defaults to zero so that no rows skip.

1

Syntax (if entering it in the Equation bar)

ACTION("TableSort",expr1,expr2,expr3,expr4,expr5)

Where

expr1 = entry under Table Name

expr2 = entry under Order

expr3 = entry under Sort Column 1

expr4 = entry under Sort Column 2

expr5 = entry under Skip first rows

expr6 = entry under Skip last rows

How the example will appear in the Equation bar

ACTION("TableSort","ABC", "Ascending", 2, 3, 2, 1)

Sorts in ascending order using cells in columns 2 as the primary sort key, and cells in column 3 to resolve sorting order for duplicate cells in column 3, ignoring the first 2 header rows and one footer row in the table.

Notes

  • If you rename a table, none of the related events (sort, insert, delete row) for that table gets an updated name. However, you can use the celltable() function to create a reference to the table. If the event is within a table, you can use celltable() to get the table label automatically. If the event is outside of the table, you can use celltable(abc.a1), where abc.a1 is a cell number, to get the table label.

    This function always returns the table label even when table abc is renumbered.

  • Table sorts cannot be done on tables that span more than one section since sorting the table could require rows not in the section be sorted above rows that are in the section. If the section covers the entire sort group, the sort is allowed.

Related Topics