Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Replace two string with each other

coder2022
5 - Atom

My data looks like this:

 

String
##123456-ID
##261111126-ID

 

And I want to replace every 6 with 2 and every 2 with 6 so the output would look like this

and I can't use a temporary word because I don't know what will be included in the string in the future

 

String
##163452-ID
##621111162-ID

 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @coder2022 

 

Let's make the temporary word more unique so that it doesn't get replaced by accident. I am creating temp words @~two~@ which have less possibility of occurring in that way. 

 

Edit: further optimizing it

 

Workflow:

atcodedog05_0-1641024457756.png

 

Hope this helps : )

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @coder2022,

 

I would go down the route of replacing the 6 with a pipe, converting the 2 to a 6 and then reverting the pipe into a 2.

 

JonathanSherman_0-1640978223380.png

 

I've attached my workflow for you to download if needed!

 

Kind regards,

Jonathan

Qiu
20 - Arcturus
20 - Arcturus

@coder2022 
You metioned that you dont want to use a temporary word so we have to make sure the Find and Replace happening only once.

So how about we just use Find and Replace?

There will be an input file, which is also easy for future maintenance and scaling.

0101-coder2022.PNG0101-coder2022-B.PNG

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @coder2022 

Happy new year to you and your close ones : ) May it be filled with happiness and prosperity =D

Labels