Hello,
I am having a hard time figuring out how to merge specific rows into one, while leaving the remaining rows as they are.
My table looks like this:
ID | Field | Value |
123 | Game | ToyStory |
123 | Animal | Dog |
123 | Animal | Cat |
123 | Animal | Horse |
123 | Flower | Tulip |
4567 | Flower | Margarida |
4567 | Animal | Horse |
4567 | Animal | Tiger |
And I want to turn it into:
ID | Field | Value |
123 | Game | ToyStory |
123 | Animal | Dog, Cat, Horse |
123 | Flower | Tulip |
4567 | Flower | Margarida |
4567 | Animal | Horse, Tiger |
Basically I want to merge only the rows in which the Field is Animal, and I want to concatenate the data using commas. While leaving all the other rows as they are. But I only want to merge those who belong to the same ID. Any ideas on how to proceed?
Hi @cutehappybear ,
You can filter out the records that contain "Animal" under the [Field] column and then feed that to a summarize tool, configured to group by ID and Field and concatenate the field [Value]. Then you can union that back to your dataset and you are good to go.
( If you want to maintain the sort order, then you can add a record ID before the filter tool and use that to grab the first record ID for each ID and animal type combo and use that after your union to sort on)
Hope that helps,
Angelos