Alteryx Designer Desktop Discussions

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

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

JustinLine
7 - Meteor

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.

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

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

 

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

Hope this helps!

JoshKushner
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_])
JoshKushner
12 - Quasar
Once again @Kenda we're in-sync. 😉
JustinLine
7 - Meteor

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

Labels