How to reverse sort a column/s in KNIME Development using Eclipse IDE

Hi Guys,

Good day. I just would like to ask for your advices on how will I reverse sort a column or columns. I will also need to use a looping in order for me to do it on multi columns. Please see image below for your reference.
image

Thank you in advance!

Br,
Gambit

2 Likes

Here’s what comes to mind first:

  1. create and fill a new column using the Counter Generation node
  2. sort the table in descending order by the counter column
  3. delete the counter column
1 Like

Hi @elsamuel ,

Thank you for your advice. However, I am developing a node using JAVA.

Thanks!

Br,
Gambit

1 Like

Hi @Gambit,

you can use the BufferedDataTableSorter to sort tables. It is quite configurable. You can see an example for a more complex usecase here:

best,
Gabriel

8 Likes

Hi @gab1one ,

Thank for this. If I have no row comparator, and I just want to sort any columns in reverse, how will I do that?

Thanks in advance.

Br,
Gambit

@Gambit
As far as I can tell, you do not need a row comparator, all you need is to call the BufferedDataTableSorter constructor with your input table, the list of column names to sort by and a boolean array that sets the sorting direction for these columns.

best,
gabriel

1 Like

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