Alteryx Designer Desktop Discussions

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

Insert Square Brackets

jakaur32
8 - Asteroid

Hello,

 

I am dealing with json output file for which I need to add these square bracket to. Down below i have shown how Name can have different values and how the outcome should look like. Please advise, thank you.

 

Data1

"Name": "AAA","BBB","CCC"

Expected Outcome1

"Name": ["AAA","BBB","CCC"]

 

Data 2

"Name":""

Expected Outcome2

"Name": []

 

Data 3

"Name":"HHH"

Expected Outcome3

"Name": ["HHH"]

4 REPLIES 4
IraWatt
17 - Castor
17 - Castor

Hey @jakaur32,

Here is a simple way to do this with a formula tool:

IraWatt_0-1654544841270.png

Any questions or issues please ask :)
HTH!
Ira

 

jakaur32
8 - Asteroid

Hi Ira,

 

Quick question...what if my input is AAA and i need it to be like ["AAA"] then what do i do.

 

or input is BBB,CCC,DDD and expected output is ["BBB" , "CCC" , "DDD"]

 

thank you.

ddiesel
13 - Pulsar
13 - Pulsar

Hi @jakaur32!

 

If you have different string formats coming in, you will need to write conditional statements for each type of record. If there are not too many different string formats, then you can build the logic into the one formula tool as @IraWatt recommended.


Even though it is more tools, I sort of lean towards a solution like this because it is dynamic to many different expected strings of data.

 

Capture.JPG

In the concatenation function of the Summarize tool, you have the option to add a start, separator, and end characters:

 

Capture (1).JPG

 

Hope this helps!

 

Deb

jakaur32
8 - Asteroid

thank you so much

Labels