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

Alteryx Designer Desktop Discussions

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

Group by Row Values

mphillips27
7 - Meteor

I have a data set that is receiving JSON Name and JSON String Values from an API that looks like the following:

JSON NameJSON String Value
ID322
FirstNameJohn
LastNamePeter
Emailemail@email.com
Number232343242
ContactID45325
ID34434
FirstNameJoe
LastNameLin
LastNameDow
Emailemail@email.com
Number4533
ContactID4646546
ID3545
FirstNamePeter
LastNameWhite
LastNameMull
Emailemail@email.com
Number45435
ContactID4534543

 

I want to group each json object so i can do text to columns grouping by the ID. Sometimes the number of rows per json object is inconsistent, for example one json object could have 9 rows, some 10, however every new json object starts with the row value "ID". Is it possible to group all of the values within that "ID" span of rows. Desired output would be:

JSON NameJSON String ValueGrouping ID
ID3221
FirstNameJohn1
LastNamePeter1
Emailemail@email.com1
Number2323432421
ContactID453251
ID344342
FirstNameJoe2
LastNameLin2
LastNameDow2
Emailemail@email.com2
Number45332
ContactID46465462
ID35453
FirstNamePeter3
LastNameWhite3
LastNameMull3
Emailemail@email.com3
Number454353
ContactID45345433
6 REPLIES 6
Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @mphillips27 ,

 

You can do this using a Multi-Row Formula that adds 1 to the Grouping ID each time the JSON Name value is "ID" !

 

Workflow attached. Tell me if it suits your need !

atcodedog05
22 - Nova
22 - Nova

Hi @mphillips27 

 

Use multi-row formula like below. To strat new block when Json Name = "ID"

 

 

 

IF [JSON Name]="ID" THEN [Row-1:Grouping ID]+1 ELSE [Row-1:Grouping ID] ENDIF

 

 

 

 

https://community.alteryx.com/t5/Interactive-Lessons/Multi-Row-Formula/ta-p/82872

 

Hope this helps : )

atcodedog05_0-1628091016348.png

HomesickSurfer
12 - Quasar

Hi @mphillips27 

 

Here's my solution.  Workflow attached.

I've also added a downstream variation that concatenates the multiple JSON values...

 

GROUPING Json.PNG

mphillips27
7 - Meteor

All of these worked, thank you!

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @mphillips27 

Cheers and have a nice day!

Jean-Balteryx
16 - Nebula
16 - Nebula

You are welcome @mphillips27! 😊

Labels
Top Solution Authors