Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

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