transformations:reordercolumnswithlist
Table of Contents
REORDER COLUMNS WITH LIST
Category: Transform / Advanced
Description
This action puts the columns of the current table in a custom order, defined by a list of column names in another table.
Use cases
- Order columns according to a list that comes from data, instead of a fixed order set in the action
- Ensure a particular order of columns before exporting to a file
Action settings
| Setting | Description |
|---|---|
| Another table | Select the other table in the project that contains the list of column names. |
| Column with names | Select the column of the other table that contains the column names in the desired order. |
| Columns that are not on the list | Choose what happens to the columns of the current table whose names are not in the list. Options: Preserve position, Move all to the left, or Move all to the right. With Preserve position, the columns that are not on the list stay where they are, and the listed columns take the remaining positions in list order. See the Example below. |
Remarks
A name in the list that doesn't match a column of the current table is ignored.
The action fails if the same name appears in the list more than once, or if a value in the list cannot be used as a column name.
Examples
Example #1
Put the "Continent" column first and the "River" column last, using a list in another table.
Before (source table)
| River | Length (km) | Continent |
|---|---|---|
| Nile | 6650 | Africa |
| Amazon | 6400 | South America |
| Yangtze | 6300 | Asia |
Other table "Column order"
| Name |
|---|
| Continent |
| River |
After (result table)
| Continent | Length (km) | River |
|---|---|---|
| Africa | 6650 | Nile |
| South America | 6400 | Amazon |
| Asia | 6300 | Yangtze |
"Length (km)" is not on the list, so it keeps its middle position. The two listed columns take the remaining positions, in the order they appear in the list.
Action parameters:
Another table: Column order
Column with names: Name
Columns that are not on the list: Preserve position
See also
transformations/reordercolumnswithlist.txt · Last modified: by roberto
