How to reverse a sorted list?

Hello, I wanted to ask if there is a way to reverse a sorted list? I have tried many things but haven’t found a solution to my very simple problem. I need a list of sorted values (similarity values from 0 to 1). I use the “Group By” node to create a “Sorted list” but the sorting order is defaulted to ascending order so it will start with any value and finish with 1 if there is one in the list) but what I want to do is reverse the list, or effectively change the sorting of the list to be descending i.e. from the maximum value to the minimum. I couldn’t do it, below is a screenshot of what I believe was my closest attempt (but even that threw an error :frowning: )

Hi @B074534 , I don’t have KNIME in front of me right now to test this, but if you sort into the required order BEFORE the groupby node, and then on the groupby node you tell it to create a list (not a sorted list) but also click “retain row order” check box, do you get what you need?


Thank you @takbb I was tired yesterday and your idea didn’t come to me, thanks for the solution!

1 Like

Hello @B074534,

there are also reverseArray() and sortArray() functions in Column Expressions node that deal with list column type. Don’t think String Manipulation node can handle them.



Or the Counter Generation node, then Sort on the count by decreasing value.

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