Alteryx Designer Desktop Discussions

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

How to convert name value pair (non-JSON) within a table column?

sxiong1
5 - Atom

Looking for help to process the data with name value pair in the format of "name1!value1, name2!value2, name3!value3, .etc." inside table using Alteryx designer. The number of pairs within this column "PATH" varies in the data set. Would like to have the output in the format with namex as field name and valuex as value under the namex (similar to table below). Thanks. 

 

10001002100710087000700290029000
0331919272729
3 REPLIES 3
BS_THE_ANALYST
14 - Magnetar

@sxiong1 here's what I'd recommend:

Step 1: Load the data in using a File Input tool

BS_THE_ANALYST_0-1681855969323.png


Step 2: Split the field 'Path' to rows on the delimiter ',' using a Text to Columns tool:

BS_THE_ANALYST_1-1681856042087.png

 

 

Step 3: Split the field 'Path' to columns on the delimiter '!' using a Text to Columns tool:

BS_THE_ANALYST_2-1681856101184.png

 

 

Step 4: Cross tab your data (pivot rows into columns):

BS_THE_ANALYST_3-1681856126135.png

 

Note, you may saee some fields with multiple values in. This is because that you had key values that were the same. 

Hopefully that helps, or at least gets you started 😎.

Any questions, let me know.

All the best,
BS

 

BS_THE_ANALYST
14 - Magnetar

Another remark I'll add. You didn't mention it - but you may want to keep the ID information.

All you need to do is add an extra step on your crosstab:

BS_THE_ANALYST_4-1681856407139.png


All the best,
BS

 

sxiong1
5 - Atom

Yes, need to keep the ID field. Thanks, your suggestion worked. 

Labels