Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Cloud Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Cloud.
SOLVED

Replace function asking for a String Constant

JordyMicheal
11 - Bolide

Has anyone had success with using the Replace function in the cloud?

I'm having a hard time doing the basic use of it.

 

I want to do something to the effect of:

Replace([Column1], "example", [Column2])

 

But this  generates the error: Argument replacement can only be a string constant

 

Has anyone found a work around to this?

5 REPLIES 5
alexnajm
18 - Pollux
18 - Pollux

What data type is column2? if it is numeric, putting a ToString function around it might do the job

JordyMicheal
11 - Bolide

It is already a string, but I loved the idea

patrick_digan
17 - Castor
17 - Castor

@JordyMicheal This looks to be a limitation of the replace functions in cloud (including regex_replace). It's a bit cumbersome, but something like this would work if there is only one instance of "example":

left([Column1],findstring([Column1],"example"))
+
[Column2]
+Substring(Column1, findstring([Column1],"example")+length("example"))

It's just grabbing the data up until the word "example", putting cloumn2 in its place, and then adding the text after "example".

alexnajm
18 - Pollux
18 - Pollux

Nice workaround @patrick_digan !

JordyMicheal
11 - Bolide

TOUGH!!!!

 

Works though - thanks so much for the assist and letting me know I'm not crazy!