Ordering concatenate using the GroupBy node

Hello, once again I’d appreciate some help with a small issue.

I have extracted a long list of operations done on patients.

Proc_ID Importance Date OperationName
2756 Primary 2010-11-29 Lumpectomy
2756 Primary 2010-11-29 Sentinel Node Dissection
2758 Primary 2010-11-23 Sentinel Node Dissection
2758 Primary 2010-11-23 Lumpectomy

[I note before I even started on this that the two procedures, identical in name, were not listed in the same order making me think that some other non-extracted field is impinging on the order of extraction from the database.]

When I use the GroupBy to group by Proc_ID or Date, and then summarise with Proc_ID{first} and OperationName{unique concatenate}, I get the following:

Proc_ID Importance Date OperationName
2756 2010-11-29 Primary Lumpectomy, Sentinel Node Dissection
2758 2010-11-23 Primary Sentinel Node Dissection, Lumpectomy

My questions are:

  1. how do I force the concatenation to always be in the same order?
    Whether that is alphabetical or ‘pre-selected’ doesn’t matter.
  2. Is the ‘forcing’ done inside the GroupBy node, or further upstream?

Once again, I pass my sincere gratitude on for the help. I am always genuinely appreciative.

A

Hello @AAM
You can test to use ‘Sorter’ node just before de Group By

BR

2 Likes

Hi @AAM ,

Inside the groupby, you have “list” option to calculate and with it, you can set just to “list” or a “list order”, that will make this sort for you at once. BUT, will create a array as [client1,client2…]

If you need to ungroup it for any other propus, just use ungroup that the knime will recognize it and break it for you, standing the list position ordered.

I hope that it’ll help you for this case.

BR,

Denis

1 Like

Hi @aam,

As @gonhaddock says sorting prior to the GroupBy should do it, but make sure you also tick the “retain row order” box at the bottom of GroupBy node config

1 Like

Thanks @gonhaddock,
that works, many thanks.
Our OIS is just like KNIME, it is so large that sometimes you don’t know what you don’t know, and it appears very simple when you find out!

A

1 Like

Thanks @denisfi,

The Ungroup option is an added bonus.
Is there some way of altering the configuration of the grouping to remove the and “”? (I understand that this might be required for the ungrouping algorithm to work.)

Thanks for taking the time to answer,

A

The options that you have are below the select options.

If won’t need to preserve the array, just mark to remove it, if you have missing values and empty arrays too.

More then this, you need to continue the flow with others nodes to make transformations.

Tks,

Denis

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