Ungrouping lists of different lengths

Hi all,

After using a JSON path node with collection queries I have lists of different lengths in columns (top table in the image). Values “e” and “f” belong in a row with value “a” and values “g” and “h” belong in a row with value “b” (bottom table in the image). Simply ungrouping everything with the ungroup node gives the result in the middle panel. Is there a way to perform this ungrouping to get the desired result or is there a different way to use the JSON path node to get to the desired result? Thanks for any suggestions :slight_smile:

image

Hi @arrtee , can you share your workflow? Or at least a Knime table that contains a sample of the group data?

1 Like

Hi @bruno29a,

Upload of a .table file doesn’t seem to be allowed (is this correct?) but this workflow recreates some example data.

Thanks for any help you can offer.
Sample ungroup data.knwf (14.8 KB)

Thanks for the workflow @arrtee . This is what I have come up with.

So, taking it from the end of your workflow, I added these:

And this is the result that I get:
image

Let me explain the logic. As you have pointed out, you have 4 elements in the 3rd column for 2 elements, and from what you described, these 4 elements are supposed to be a sets of 2 elements.

So, that was the idea, I converted the 4 elements of the 3rd column into sets of 2 elements and then ungroup.

To do so, I separated the 3rd column (hence the column splitter) from the 2 other columns, processed it, and then join back with the other 2 columns and ungroup.

Here’s the workflow: Ungroup data.knwf (26.8 KB)

4 Likes

Great, that works, thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.