Free Trial

Alteryx Designer Desktop Discussions

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

Alteryx String Conversion

mark_paul
8 - Asteroid

Hi All,

 

Could some one let me know how to convert below string?

 

Input String:

(((Type1 = "TEST") AND (Code1 in "X, Y, Z")) OR ((Type1 = "TEST") AND (Code2 in "A, B, C")))

 

Output String:

(((Type1 = "TEST") AND (Code1 in ("X", "Y", "Z"))) OR ((Type1 = "TEST") AND (Code2 in ("A", "B", "C"))))

 

Thanks,

Mark

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

What do you mean by convert? As in you have the input and want to get to the output (by adding some extra punctuation), with a formula? If so, are you needing it to be dynamic? I’m a little confused about the request sorry.

mark_paul
8 - Asteroid

Hi @DataNath,

 

Yes, need to add some quotes and punctuation to the input string 

 

Thanks

Mark

mark_paul
8 - Asteroid

@DataNath , Need to be dynamic 

 

Thanks

Marks

DataNath
17 - Castor
17 - Castor

Not sure if it's totally ridiculous or if something like this may work:

 

DataNath_0-1652666457804.png

 

At the minute, the capture groups are all just set to \w{1} i.e. single letters, as they appear in your example. Can be changed easily if real inputs will be different. Workbook attached.

ArtApa
Alteryx
Alteryx

Hi @mark_paul - You can simply use a Replace functions: 

 

  • REGEX_Replace([Input String], '(\"\w, \w, \w\")', '\('+'$1'+'\)')
  • Replace([Output String], ',', '","')

ArtApa_0-1652673568418.png

 

Labels
Top Solution Authors