Alteryx Designer

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

If a Column Name is _____, rename it, otherwise take no action

Highlighted
6 - Meteoroid

Hi there, I am fairly new to Alteryx and I haven't been able to find an answer to this question by searching.

 

I have an Input tool that I want to be able to read in any delimited .txt files placed in a directory. There are two types of files that share quite a few columns. One file has all of the columns that the other file has and then some. The other file has a column that was named "Promary" when it should have been named "Primary" to match the other file.

 

How do I tell Alteryx to look at the Input and if it has the column labeled "Promary" change the name to "Primary", if that column name is not present, then don't take action? It seems like the only solution that I can think of will give me an error when it doesn't have a column named "Promary".

 

Thanks in advance for your help.

Highlighted
14 - Magnetar
14 - Magnetar

Hey @JustinLine! Try adding a Dynamic Rename tool after your input with the following formula:

 

iif([_CurrentField_]="Promary","Primary",[_CurrentField_])

Hope this helps!

Highlighted
12 - Quasar
You can use the Dynamic Rename tool.

Feed the data from the input into the 'L' input.
Select 'All' fields and rename based on the formula:

IIF([_CurrentField_] = "Promary", "Primary", [_CurrentField_])
Highlighted
12 - Quasar
Once again @Kenda we're in-sync. 😉
Highlighted
6 - Meteoroid

Thanks, this is going to help me with some other problems too!

Labels