How to dynamically update field names in Alteryx

by Daniel Watt

Occasionally you will receive a data set without any headers and you will need to find the header names from a different data set.  Here is an example of data without a header row from the current Premier League standings.

F1 F2 F3 F4 F5 F6 F7 F8 F9 F10
1 Man City 9 6 2 1 20 9 11 20
2 Arsenal 9 6 2 1 19 9 10 20
3 Liverpool 9 6 2 1 20 11 9 20
4 Chelsea 9 6 1 2 19 9 10 19
5 Tottenham 9 5 4 0 13 4 9 19
6 Everton 9 4 3 2 13 8 5 15
7 Man Utd 9 4 2 3 13 12 1 14
8 Southampton 9 3 4 2 11 8 3 13
9 Bournemouth 9 3 3 3 12 12 0 12
10 Watford 9 3 3 3 13 13 0 12

And here is a table containing the field names:

Field number Field
1 Position
2 Team
3 Played
4 Win
5 Draw
6 Loss
7 Goals For
8 Goals Against
9 Goal Difference
10 Points

 

Using the Dynamic Rename tool we can take the field names from the table above and use as the headers on the table at the top.  The first step is to connect the two tables to the dynamic tool, the data table to the left input and the field table to the right input as shown below:

dynamic-rename-workflow

The second step is to configure the tool.  Click on the Dynamic Rename icon in the workflow and you will see the configuration pane on the left hand side of the screen.  In this instance we are going to set the rename mode to ‘Take Field Names from Right Input Rows’.  Other rename options include formula (eg. if then statements), add or subtract prefix/suffix and take fields from the first row of data.  Those options only require one data input, whereas the option we are using requires two inputs.

The options in the configuration pane will update based on which rename mode you have selected.  With the ‘Take Field Names from Right Input Rows’  we just need to choose the old and new field names.  As you can see below I have chosen positional rename as the old field name – this means that I am matching the column number in the data table with the row number in the field table.

dynamic-rename-config

Fri 06 Jan 2017

Thu 05 Jan 2017

Wed 04 Jan 2017