Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Find Replace Tool with Comic Book Characters

dawnh80
8 - Asteroid

Do you have part of a phrase in a column and you just need to replace one word? What if you wanted to add another word in that same cell?

 

In the example data below I need to add the word Comics to the cell containing Batgirl DC and I need to add Marvel Comics to both of the cells with "Xmen" characters.

 
Marvel.jpg
 

How do I do this? With the Find Replace Tool!

 

First I drag a Text Input Tool with the characters I want to replace in a Word column. Then I type in the words I want to replace it with in a Replacement column.

 
 
Textinputreplace.jpg

 

 

Next I drag the Find Replace Tool to the canvas, attaching the first dataset to the F input anchor and then I connect the replacement dataset to the R replacement anchor.

 

As you see in the image below Alteryx identified that I want to search the column Character and I want to find the value from the column Word in my second data set. It also selected the Replacement column for the column containing the replacement.

 
 
FindReplaceoptions.jpg

 

 

Notice at the top you can set this tool to search for the Beginning of a field, Any Part of the Field or the Entire Field. For this example Any Part of the Field will suffice.

 

I don't need to check Case Insensitive Find since it appears the cases are the same.

 

I also don't need to check Match Whole Word Only.

 

The output appears as below with these options selected;

 
findreplaceoutput.jpg
 

I could select the option to Append Field to Record to add the replacement as a new column. The results would appear as below if I selected that option;

 
Otheroption.jpg

In the next example I want to replace the beginning of the cell with a replacement. What if I wanted to remove the word The in from of Green Lantern and I wanted to change BATMAN to title case Batman.

 
2ndfindreplace.jpg

 

I would add another Text Input Tool with the following;

 
 
2ndreplacement.jpg
 

I put nothing in the Replacement column for The.

 

I add my Find Replace Tool with the following configuration;

 
 
find.jpg

 

 

Notice I am simply changing the radio button to Beginning of Field.

 

My results are shown as below;

 
findreplacePic.jpg

 

 

Oh no! There is a leading space now in front of Green Lantern. I simply go back to the The in the second data set and add a space after it.

 
 
findreplacefix.jpg

 

 

Please note: There may be instances where you want to use the Find Replace Tool instead of using a Join Tool. If you are only bringing in one column, it may be faster to go this route instead.

 
 

In the example below, I have two data sets;

 
twodatasets.jpg

 

 

I want to bring in the Issue column into the final dataset, next to the Comic Company column. I could join the two data sets with a Join Tool on the Characters = Field 1 columns.

 

Or I could add the Find Replace Tool and configure it like below;

 
 
configure.jpg

 

My output will appear as below and the workflow will be much faster!

 
output.jpg
 

As you can see in the Results log it went from .3 seconds to .2 seconds by using this tool!

 

ImprovedPerformance.jpg

3 REPLIES 3
csmith11
11 - Bolide

This is awesome! Good read.

 

Quick unrelated question: What tool are you using for the screenshots / arrows?

dawnh80
8 - Asteroid

I am using Snag It! I love that tool. 

mutama
Alteryx
Alteryx

Really awesome and creative write-up, @dawnh80 ! 

 

This can even be a potential Weekly Challenge Scenario. If keen, would you like to recommend this as a Weekly Challenge via this thread here? https://community.alteryx.com/t5/General-Discussions/Weekly-Challenge-Improvement-Ideas-Wanted/td-p/...

 

Happy Alteryx-ing!

 

Best,

Michael

Labels