Skip to main content

Dynamic Rename tool Dynamic Rename Tool

One Tool Example

Dynamic Rename has a One Tool Example. Go to 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, pull column names from the first row of data or a description file, or 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 notification behavior: Warn, Error, or Ignore.

Take Field Names from First Row of Data

Selected columns are renamed by turning the column name into the value found in the first row. Under Properties, select the notification behavior for when fields are missing: Warn, Error, or Ignore.

Note

If the value in the first row is Null, the field/column is automatically named according to these rules:

  • The field name is Field_(n + 1) where n = the total number of fields/columns in the incoming data stream.

  • After Field_9, the next field name is Field_9_2, Field_9_3, and so on.

Refer to the below example for clarification.

Field Rename Example

For example, a dataset contains this data:

Field 1

Field 2

Field 3

Field4

Field5

Field6

Field7

Address

City

ZIP

[Null]

[Null]

[Null]

[Null]

3825 Iris Ave

Boulder

80301

[Null]

[Null]

[Null]

[Null]

If the columns are renamed with the field names from the first row of data, the dataset changes to:

Address

City

ZIP

Field_8

Field_9

Field_9_2

Field_9_3

3825 Iris Ave

Boulder

80301

[Null]

[Null]

[Null]

[Null]

Note that the above example contains several fields/columns where the value in the first row is Null. Referring back to the note above, in the example, there are 7 fields/columns in the incoming data stream, so n = 7. As a result...

  • The first Null field/column name is Field_8.

  • The second Null field/column name is Field_9.

  • The third Null field/column name is Field_9_2.

  • The fourth Null field/column name is Field_9_3, and so on.

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 does not match, select the notification 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 notification 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 to reassign 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 notification 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 notification 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 to reassign 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 the 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.