Sorting rows according to edited nominal domain values

Hi,

I am new to KNIME and looking for help on a sorting issue. I have a table with a column of type string with a dozen nominal values. I use the “Edit Nominal Domain” node to give a suited sorting order to the domain values. However, when I apply the “Pivoting” node and use the a.m. column as a group column the pivot table output comes in lexicographical sorting. I have not found a way to get my defined sorting order. Also the “Sorter” node seems to be of no help.

Any suggestions?

Thanks for this great piece of software.

Ulrich

1 Like

Hi Ulrich,

in the lower part of the configuration of the pivoting node you find a checkbox “Retain row order”. Maybe this solves your problem already?

Cheers,
Kathrin

Dear Kathrin,

thanks a lot for your quick reply. When I check the “Retain row order” option the resulting table has a more or less random row order - probably driven by the unsorted input table. So, unfortunately this does not solve the issue.

Best wishes

Ulrich

Hi @upegelow,

as a workaround you could try to prefix your Strings with letters and an underscore such that the lexicographical ordering of the Strings would yield your order (e.g. ‘a_’, ‘b_’, ‘c_’ and so on). This could be done e.g. using the Rule Engine or the Column Expressions nodes. Afterwards, you can chop off everything before the underscore to get the original Strings.

Cheers,
Davids

Dear Davids,

this really sounds like a viable workaround.

From a more general perspective it seems that the settings done in the “Edit Nominal Domain” node currently cannot really be employed further downstream when it comes to sorting.

Best wishes

Ulrich

Hi @upegelow,

thanks for pointing that out. We’re going to look into that.

Cheers
David