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

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
17 - Castor
17 - Castor

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
17 - Castor
17 - Castor

Nice workaround @patrick_digan !

JordyMicheal
11 - Bolide

TOUGH!!!!

 

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