Table Row/Column Sort
Generator: Table Row/Column Sort
This generator looks at all of the input Table Items and for each one, applies a hierarchical sort to the rows and/or columns of the table. There will be one output table for every input table. Note that the type of sort (numeric vs string) is selected by the type of the data in the table item. In some cases, it may be necessary to convert a table to numeric format to get the desired sorting.
There are a few configuration options for this generator. The first is the ability to set the name for the generated table(s). The table name can include macro expansions and will use the current data item to access additional macro sources (e.g. tag values).
The row/column sorting editor is the same dialog as used for sorting data items in layouts. There are separate buttons used to set the sorting rules for the rows and columns. These rules are applied independently. Rows or columns can be sorted using values in specific columns or rows respectively. It is also possible to select 'Labels' to specify that the values of the column or row labels be used to sort the rows or columns.
The example here targets a single table and uses a template layout that looks like this:
The top level template simply filters the input down to the one table we wish to process. The raw table is displayed by the 'Unsorted' panel template. The beginning of that output looks like this (there are many more rows not displayed here):
The 'Sorted' template is an instance of the Table Row/Column Sort Generator. It sorts the columns using the labels for the columns sorting in an increasing fashion left to right. The 'Select rows to sort columns by...' configuration looks like this:
The 'Select columns to sort rows by...' configuration looks like this:
When considering the proper order of the rows, this configuration specifies that the 'User' column value is the primary sort key. If there is a tie, the 'Version' column value will be used and if there is still a tie, the 'Date' column value. In all cases, the sort is performed from smallest to largest value.
The resulting sorted table is displayed like this: