select-columns
Selects a list of columns from a datatable in a specified order.
Enables selection of a subset of columns from a datatable.
Defines the order of columns in the output.
Arguments
Inputs:
data
: The datatable containing columns to be selected.
columns
: The list of columns to be included, in the specified order.
Output:
data
: A datatable with the selected columns, in the order defined in columns
.
Example
To sort columns alphabetically, the Select-columns adaptor can be used in concert with Datatable-columns and Sort-list.
Original data:
Final data: (column names are sorted alphabetically)
Another option in this case is to sort the columns using Datatable-columns and Sort-list, but instead of feeding the results directly into the columns
argument of Select-columns, copy-pasting from the Sort-list output, enabling you to easily sort a subset of columns alphabetically.
Possible use cases
Selecting a subset of columns for final data-flo output
Selecting one or more columns to send on a particular processing path through other adaptors
Reordering columns to match an expected output order
Reordering columns to get two columns next to each other for easy comparison during the data-flo build process
Last updated