put rows back together and their values from specific column

Hi everyone :smiley:
I would like to put my rows back together using this logic:

  • if my row in column “RowIDs” has multiple “children”, put together all rows which come from the same “original row”. my data so far looks like this:

for example:

  • put back in one row Row0_1 and Row0_2 and Row0_3 and Row0_4 and also put in one column all values from the column “ColumnValues” for the respective rows.

So my output should look like this:

image

Any tips and tricks for me so I can accomplish this operation?
Thanks in advance!

Kind regards,
Denis

Hi Denajaha,
You should:

  1. use String Manipulation node, with function regexReplace:
    regexReplace($RowIDs$,"_\d+","") - you can replace original column or create new one.
  2. use GroupBy node with replaced/new column as group column and column named ColumnValues as grouped column with concatenate as aggregation method.
    I hope this help.
    Piotr.
1 Like

Hi Piotr! thank you for your reply :smiley:

  • I implemented String manipulation node:

image

But unfortunatelly it still gives me the same thing:

And I am not so good with regEx and I do not know what to try as another solution for my problem…

  • regarding the GroupBy node I implemented it like this:

After node execution I have this result:

And unfortunatelly that is not form I need in this workflow.

Any other ideas / solutions?

Three should be two backslahes on regexpReplace($RowId$,"_\\d+","")
Sorry my mistake.
And in Group by node you must add column with corrected RowId on Groups chart
Piotr

Ok looks better now! Do you know maybe have an idea on how to get my final form I have posted in my question? I want to order ColumnValues in a list so they still belong to their original row…
Here is the picture I have posted:

https://forum.knime.com/uploads/default/original/3X/4/3/432ac5c237e565315c4605726380966f77c1a446.png

Hi,
Happy that you succeded with regexp.
To get everything to work you need to add column with improved RowId on groups tab which is next to manuał aggregation tab on the left in the GroupBy Node.
Regards
Piotr

I’ve attached a workflow. It’s doing what you need. See also attached graphics.

KNIME_project.knwf (13.5 KB)

1 Like

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