In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Replacing Multiple String Characters in another String

KerryW
7 - Meteor

Struggling with a way to solve for injecting 1 string into another dynamically

 

CustomerTemplateOutput
FGASXXXSFGA
FGASNXXSXSNFGSA
FFFXXXSBFFFSB
FFFFFGGAASXXXXXNXXXXNSFFFFFNGGAAN
FX

 

 

Replace each "X" in the Template column with a value from the Customer string.
Example Customer FGA
Template = SXXXN
Result SFGAN
The letter X will never appear in customer data
The number of X positions in the template will always equal the number of positions in the Customer filed
The length of the template can be 1 to 50


Ive attempted

replace formula 
REGEX_REPLACE - though I dont see a way to step through characters
multi-field formula with a reg ex- like REGEX_Replace([Template], "X", Substring([Customer], Mod([Row-1:Customer], Length([Customer])) )) - I suspect this could be the best solution, but just cant get it right!


any ideas/ solutions would be greatly appreciated!

1 REPLY 1
FinnCharlton
13 - Pulsar

Hi @KerryW , here is a short workflow that will do this for you:

FinnCharlton_0-1677861564096.png

 

Labels
Top Solution Authors