Select, remove, rename, reorder columns

There are multiple ways to tell Data-flo which columns to send to output, and in what order.

Adaptors are multifunctional

Use Select-columns to

  • choose columns

  • set the order of columns

Use Remove-columns to

  • choose columns

  • no change to order of columns

Use Rename-columns **** to

  • rename some columns (or all columns)

  • keep or discard remaining columns

  • no change to order of columns

TIP: Use with Datatable-columns and "Bind to Data-flo input" to enable users to define the columns from the Run Page.

Using Select-columns

Keeping most? Highlight and copy the column headers from the data. Paste them into the columns argument, where they become a list. Delete any column names from the list that you don't want to keep. Use this instead of Remove-columns if you want to change the order of columns in the output.

When working with a list of key-value pairs or columns, using <control> or <command> with the up/down arrow keys will move the selected item to the top or bottom of the list. TIP: use the Sort-list adaptor as an input to the column argument in Select-columns, if you want to sort alphabetically.

Using Remove-columns

Highlight and copy the column headers to remove, and paste into the column argument using "Bind to a value". It auto-transforms the copied columns to a list of columns to remove.

Using Rename-columns

This adaptor can be used to rename a single column, or all columns, or a subset of columns, using a mapping of old column names to new column names. Columns excluded from the map can be discarded or included with their original names.

The Rename-columns adaptor has a discard argument, which allows you to remove all columns that are not mapped in the renaming mapping argument. Thus, you can map all the columns you want to keep (even if their names are not changing) and leave discard set to 'true' (this is the default setting).

TIP: Rename columns early in the data-flo to simplify other transformations, such as Join-datatables.

One method: Run the data-flo in Debugger Mode to make data visible. Copy the headers from the data visible when you click on the CSV argument. paste into excel & transpose, then in next column do same with new header names, then copy all and paste the whole list into key-value pair area. Check whether this is necessary or if can paste right into key-list only or value-list only Specify column order in Data-flo output: Sort datatable is equivalent to an order by statement if you need that.

Last updated