select
Reorder table columns.
Reorder the columns in a table according to specified column labels. This operator is useful if you have a table with numerous columns and want to reorder some of them. One of the columns can be "*", which represents all columns in the table except the ones that are listed as arguments.
Operator Usage in Easy Mode
- Click + on the parent node.
- Enter Select operator in the search field and select the operator from the Results to open the operator form.
- In the Input Table drop-down, select the input table.
- In the Columns drop-down, enter or select a column.
- Click Run to view the result.
- Click Cancel to discard the operator form.
- Click Submit to add the operator to the playbook.
Usage Details
select(tablename, columns)
-- tablename: name of table to apply an operator
-- columns: list of columns e.g. select(table, col1, col2, col3 ...)
-- NOTE: one of the columns can be "*" which represents all columns in the table EXCEP the one those are listed in the args
Example
Input
col1 | col2 | col3 | col4 | col5 | col6 |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 |
select(inputTable, "col2", "col6")
-- should produce table(col2, col6)
select(inputTable, "col2", "col6", "*")
-- should produce table(col2, col6, col1, col3, col4, col5)
select(inputTable, "*", "col2", "col6")
-- should produce table(col1, col3, col4, col5, col2, col6)
select(inputTable, "col2", "*", "col6")
-- should produce table(col2, col1, col3, col4, col5, col6)
select(inputTable, "col2 as newcol1", "*", "col6 as newcol2")
-- should produce table(newcol1, col1, col3, col4, col5, newcol2)
Updated about 1 year ago