Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Dynamically change the Column Header Name

shivamy241
6 - Meteoroid

I am new to the Alteryx. I have a requirement where i have to change the Column header name dynamically. I have attached a file that contains all information. 'Technical Field Label' is a actual field name, and 'Field Info - Usage by Country code and Field label used by country' is the field that contains the new column headers. Row no. 5 to 25 contains the country code and Header name that needs to be replaced, based on the country code the column header name assign the Column header name. 

 

Process:

- Read the input file name '1209_XXX_EC Delta_POL_May_08_25_2020' where 'POL' is the country code.

- Read the file name like this and based on the country code from the file name rename the field header from the excel file.

 

 

 

 

4 REPLIES 4
echuong1
Alteryx Alumni (Retired)

Are you able to upload an example of what you're looking for with the output?

 

I'm thinking you can do something like this to parse out each country code, the field names for each country, and the associated technical field name. You'd have to create a list for the fields that apply to all countries as well. From there, you can filter for the country the file is for, and then use a dynamic rename to use the "old" and "new" field names.

 

Hope this helps!

 

echuong1_0-1600185628388.png

 

shivamy241
6 - Meteoroid

I have attached an input file '1209_XXX_EC Delta_POL_May_08_25_2020' that contains the original column header. 

Another file contains the Countrywise field sets. Take '1209_XXX_EC Delta_POL_May_08_25_2020' as main input file. Read the file name and look for the country code in the file name. Now take that country code and go to 'Countrywise_Record' reference file. Now original fields (from '1209_XXX_EC Delta_POL_May_08_25_2020' needs to be renamed with the new field name from 'Country_Record').

 

There is a 'Final_Output' file attached which contains the renamed record for 'Country Code' = POL.

 

If the field name from the Input file ''1209_XXX_EC Delta_POL_May_08_25_2020' ' matches with the reference file 'Countrywise_Record' then rename it as per 'Countrywise_Record' else return the original field name from the input file '1209_XXX_EC Delta_POL_May_08_25_2020'. Need to compare it for each country code.

echuong1
Alteryx Alumni (Retired)

The attached solution achieves what you're looking for using the original file you provided. Essentially, the top section creates a list of your field names and corresponding country field name. The bottom section parses the file name to find the proper country code to use. The dynamic rename at the end renames the columns accordingly.

 

HOWEVER, your reference list of field names needs to match exactly. You'll notice it is not renaming the fields as expected because they are different. For example, the field is called "Address 1" in your file and "address1" in your reference file. These need to match exactly for this to work. Please update your reference file.

 

echuong1_0-1600264697117.png

 

shivamy241
6 - Meteoroid

1.JPG

Can you please explain Regular expression that you have used here?

Labels