Feature request: GroupBy: Order

Hi everyone,

recently I found something that I think is missing from Knime so far. I would like to get a value of a column which is on the same row where another column has its maximum.

In R, there is a function "order" that gives the order in which an array would have to be sorted (i.e. order([5, 4, 7]) == [2,1,3]). This function could prove quite practical as an option in the GroupBy node.

So far, my solution is to use a GroupBy node, list the values and iterate over them with a Java Snippet node, in order to find the maximum value and its. Using a normal Sort + Row Filter Node combination would not support grouping. Is there any better option already?



Hi Lorenz,

I believe that this can be achieved with a Sorter and a GroupBy-node: You first sort your table on the "other column" in descending order, then you use the GroupBy-node with "First" as aggregation function on the column(s) that you are interested in. This should give you the value(s) of the maximum row per group.



The method Nils uses works perfectly, I have been using the same method of sorter and groupby on first for along time without issues.


The order() function would be more flexible, e.g. when you want to have the n best scoring values.

But nonetheless I want to thank you both, your suggestion fixes my problem.




Hi All,

In relation to this; I would like to select the 8 largest numbers. I have tried using a combination of a sorter and GroupBy concatenate to realise this, but unfrotunately am not able to get the desired solution. Any ideas?



Sorter + Group Loop + Row Filter maybe?