Sorting based on ID Number

I want to sort the classified data based on the Row Id. The Problem I have is that the KNIME Node "Sorter" doesn't sort the ID's in the order: 1,2,3.....,10 but 1,10,2,20,....

Any suggestions?


Thanks!

Hi,

you need to extract the RowId with a RowId node into a separate column. Then use the cell Splitter by positon (or the String Manipulation) to extract the sorting number only. Finally you maybe need to change it to a number with the String to Number node, before you can finally use the Sorter on your newly created column.

See here as well: http://tech.knime.org/forum/knime-general/sorting-on-rowid

Cheers, Iris

Hi Iris!

 

Thanks for your answer. But my Problem is not extracting the number as itself. My IDs are now a list containing only numbers, e.g. 1,2,..10. But now I need a sorted list of this IDs as 1,2,3,... and not 1,10,11... Is there any possibility to get it in this order?

Best,


Sarah

If they are just numbers try converting the string to a number (String to number node). The sort should then work.

All of the suggestions are workarounds.  This topic has been brought up on at least 2 separate occasions.  The RowID column should have the ability to be sorted correctly, instead of messing around with additional nodes (my workflows are large enough , thank you).  See other threads below relating to this topic:

http://tech.knime.org/forum/knime-general/sorting-on-rowid

http://tech.knime.org/node/39198/view

Stephen

 

^2

Hard to believe that there's still no numeric sort option on RowID in the Sorter node. (Granted, the RowID node makes the workaround less of a hassle, but still a hassle.) The solution as proposed by thor would fix it elegantly.

RowID's are not per-se numeric. Look what happens if you aggregate or join data.

So there is your answer: RowIDs are not sortable as numbers because they aren't numbers.

On the other hand it would be a nice addition if sorting can be done on a 'numeric interpretation' out of the box instead of the counter-intuitive strict string sorting.