One primary use of the Tabular Columns Re-Arranger handler is to structure the data to the destination’s required format, for instance, before being exported to a database table.
The handler provides a way of re-arranging the order of existing columns in a block of tabular data. You can also use this handler to drop/delete unwanted columns, or to create extra columns by duplicating the existing ones.
Created new columns are commonly used for placeholders for inserting new data values, such as timestamps or idetifiers (which typically are created using Functions), into the existing tabular data block.
One additional/non-primary feature of the handler is to trim leading and trailing spaces from all cell values of the output data. This is in comparison to the TRIM function available in the TabularDataTransformer handler, which only works on a specific column at a time.
By pre-defining the input tabular data’s columns as $1, $2, … , $N, the columns-order parameter simply specify in the rule which columns would be kept as a part of the output, also in which order.
|columns-order||Specify the output tabular data format, in terms of the columns and their orders, with references to the input data. Eg. the input columns are referred to as $1,$2,$3,…,$N, and the output is specified, for example, as ‘$2,$3,$1’.|
|trim-selected-columns||Specifies whether to trim leading and trailing spaces in the output, if present from the input data. The valid value is “YES” for trim, anything else for not applicable.|
In the following example, the handler’s config specified one transformation rule: concatenate cell $2 and cell $3 from a tabular row, with a hyphen in between, and assign the concatenated string to cell $1 of the same row.
<Handler>TabularColumnsReArranger</Handler> <Parameters> <Parameter> <!-- the column #2 is dropped from the input and the column #4 is repeated in the output --> <Name>columns-order</Name> <Value>$1,$3,$4,$4</Value> </Parameter> <!-- trim leading and trailing spaces from all output cells --> <Parameter> <Name>trim-selected-columns</Name> <Value>YES</Value> </Parameter> </Parameters>