Dynamic Rename Tool
One Tool Example
Dynamic Rename has a One Tool Example. Visit Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.
Use Dynamic Rename to rename columns within an input data stream. Use this tool to parse text files, to pull column names from the first row of data or a description file, or to rename a pattern in the column names, such as removing a prefix or suffix, or replacing underscores with spaces.
Configure the Tool
Select a Rename Mode:
Formula
Columns are renamed based on a built expression. To build an expression to rename selected fields, either enter text directly in the expression editor or double-click a variable or function from the Properties section to add it to the Expression editor.
Select the fields to be renamed by selecting the checkbox next to the field name or by clicking the All button.
Select Dynamic /Unknown fields so columns not present at configuration are renamed at runtime.
Current Field is the individual field the formula is applied to. Each field selected from the list of fields will have the formula applied to it.
Add Prefix/Suffix
Selected columns are renamed to include a prefix or suffix.
Under Properties, enter a prefix or suffix to Add to each selected column name.
Select either Prefix or Suffix.
Remove Prefix/Suffix
Selected columns are renamed to exclude a prefix or suffix.
Under Properties, enter a prefix or suffix to Remove from each selected column name.
Select either Prefix or Suffix.
If any of the selected columns are not renamed, select the report behavior: Warn, Error, or Ignore.
Take Field Names from First Row of Data
Selected columns are renamed by turn the column name into the value found in the first row.
Field Rename Example
For example, a dataset contains this data:
Field 1 | Field 2 | Field 3 |
Address | City | ZIP |
3825 Iris Ave | Boulder | 80301 |
If the columns are renamed with the field names from the first row of data, the dataset changes to:
Address | City | ZIP |
3825 Iris Ave | Boulder | 80301 |
Under Properties, select the report behavior for if fields are missing: Warn, Error, or Ignore.
Take Field Name from Right Input Metadata
Selected columns are renamed using the field names from a second input, connected to the R anchor. Only the field names from the second input are brought in; the data does not come through.
If the number of field names do not match, select the report behavior: Warn, Error, or Ignore.
Select Change field type and size to match the data type and size of the incoming fields as well as the name.
Take Field Names from Right Input Rows
Selected columns are renamed by taking row data from a second input file and applying the data based on row position or field map assignment.
Under Properties, select the report behavior if the number of field names does not match: Warn, Error, or Ignore.
Old Field Name from Column: Select from the list of R input field names, which includes the old field names. Use Positional Rename reassigns field names based on their row position in relation to the field position on the left.
New Field Name from Column: Select from the list of R input fields, which includes the new replacement field names.
Take Field Descriptions from Right Input Metadata
Selected columns are updated so the descriptions match the field descriptions from a second input that is connected to the R anchor. Descriptions are updated based on the positions within each input.
Under Properties, select the report behavior if the number of field names does not match: Warn, Error, or Ignore.
Take Field Descriptions from Right Input Rows
Selected columns are updated so the descriptions match the descriptions from the input rows of a second input that is connected to the R anchor.
Under Properties, select the report behavior if the number of field names does not match: Warn, Error, or Ignore.
Field Name from Column: Select from the list of R input field names. Use Positional Rename re-assigns field names based on their row position in relation to the field position on the left.
New Description from Column: Select from the list of R input fields, which includes the new replacement description values.
Troubleshoot
When you use a right input for field names, be aware of the record order. A Join or similar tool can change the order of records, which could result in incorrect field name assignments.