Alteryx Designer Desktop Discussions

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

Rename Column Headers

aishwarya_baburaj98
6 - Meteoroid

Every month my input column header for two of the columns change. For example: In Nov-2021, below would be my column headers:


Description
Period 11
Actual
2021
Cumulative 11
Actual
2021
x10005120
y20006000
z30005000

In Dec-2021, below would be my column headers: 


Description
Period 12
Actual
2021
Cumulative 12
Actual
2021
x10006210
y20008000
z30008000

 

I want to rename 2nd and 3rd column headers as 'Actual Amount' and 'Cumulative Amount', respectively. How can I do this?

2 REPLIES 2
AngelosPachis
16 - Nebula

Hi @aishwarya_baburaj98 ,

 

There are many ways that you can make this happen, which one is best is another story as it depends on your actual data.

 

Given the provided data table though and assuming that your headers always come in in this format "Period (month) Actual (year)" or "Cumulative (month) Actual (year)", you can use a dynamic rename tool with a Regex match function to rename your fields dynamically.

 

Another way would be to use a contains function, to look for the words "period" and "actual" within a header, and replace it with "actual amount", but this will rename all headers that may contain both those words, so look out for that.

 

AngelosPachis_0-1638027570654.png

 

You can try changing the month and year in your input and you will notice that still your columns get renamed. This method is not going work if you have data for two months for example in the same table, i.e. if you had both November and December data in your input, as Alteryx will assign the same header to all months, and since you can't have columns with the same headers, the second one will be renamed to "Actual Amount2".

 

Hope this helps,

Angelos

 

danilang
19 - Altair
19 - Altair

Hi @aishwarya_baburaj98 

 

If it's always the 2nd and 3rd column that you want to rename you can use this technique that uses the order of the fields with no regard for the names.

danilang_0-1638036169850.png

The Field Info tool returns the names of the fields and their sizes and types as a set of rows.  Add a FieldOrder to this and explicitly rename the 2nd and 3rd columns

 

Dan

Labels