We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Replace Name in Multiple Fields

shaheer
8 - Asteroid

Hello. I have a large set of data with many columns. I want to use the multi field formula tool to look for a specific case of a name, such as "The Rock" and change it to "Dwayne Johnson".

 

I already have an expression in a multi field formula that changes around names for me like so:

shaheer_1-1666191732171.png

 

I want to add the formula to this tools expression if possible like so:

 

shaheer_2-1666191806030.png

 

The reason why I want to do this is because when I add a second multi field formula tool right after the first one, I am unable to select any of the fields like I could in the first tool:

 

shaheer_3-1666191877017.png

shaheer_4-1666191914086.png

As you can see, in the second multi field formula tool, I am unable to select any fields. Any help would be appreciated.

14 REPLIES 14
binuacs
21 - Polaris

@shaheer Can you provide a sample input and expected output result?

shaheer
8 - Asteroid

For example, input is:

 

Preferred Full NameAgeName2Name3Experience (years)
Rock, The40Cates, AnnaJames, Henry5
Gunn, James50Rock, TheAllan, Barbara4

 

After my regex replace formula Regex_Replace([_CurrentField_],'(\w+),\s?(\w+)','$2 $1') which is used in the multi field formula tool and selects the columns with names, output would look like:

 

Name1AgeName2Name3Experience (years)
The Rock40Anna CatesHenry James5
James Gunn50The RockBarbara Allan4

 

Next, I've tried using the formula tool like so:

 

shaheer_0-1666195719722.png

 

Which should change "The Rock" to "Dwayne Johnson" (I am having trouble with the syntax). I will then apply this same formula to all other columns by pressing the + symbol and changing the column name accordingly.

DataNath
17 - Castor
17 - Castor

Hey @shaheer, this is what I mentioned in my previous post and gets your desired answer:

 

DataNath_0-1666196097296.png

 

I'd definitely recommend sticking to your current approach of Multi-Field formula - doing this with a regular formula tool several times is way more inefficient and there's no need.


One thing to note is what I mentioned before - if there's a lot of names that you want to replace then I'd recommend doing a lookup table with find & replace rather than relying on an if statement.

binuacs
21 - Polaris

@shaheer The Regex_Replace() formula you used is not correct. I provided a sample workflow for your reference

 

binuacs_0-1666196576706.png

 

shaheer
8 - Asteroid

Thank you so so much

Labels
Top Solution Authors