Sort a table by physical conditions

Hi KNIMErs,

maybe someone of you can give me a trick how to sort a table by physical conditions. In my special case I have a table with some Integer columns and some String coulms and an Id column. In the “Temperature” string column there are the conditions “cold”, “hot” and “warm”. Now, I want to sort my table by “cold”, “warm” and “hot” inside each Id in the Id column.


The ReadOut_Id column is my foreign key later in my database. My primary key has a timestamp so my dataset is a kind of time series data.
I visualize the table in Power BI and if I filter to one timestamp the dahsboard look like this.

This is quite nice but the “physical sorting” of temperature dosen’t fit

If I change the filter to more than one timestamp Power BI visualizes the dashboard like this.


You can see that Power BI sorts the Temperature column alphabetical.

Long story short: I need a sorting column which first considers the temperature condition and will then continue for each ReadOut-Id.

The perfect result should look like this. (I will cut the data in this little example)
In Power BI I will be able to sort my data in the correct physical order by each freign key
image

Has anyone of you an idea how to deal with this in KNIME?

Many thanks in advance
Brotfahrer

Hi @Brotfahrer , looking at your data, it seems to me that you need to sort by three dimensions:

Readout_id
Shift Element
Temperature

Oh hang on… Maybe 4 elements…

Readout_id
Date of readout
Shift Element
Temperature

For temperature I would use a rule engine or other lookup to assign a sort index ( c=0, w=1, h=2)

Hi @takbb , thanks for your ideas and this discussion,

I got my solution within a Group Loop Node. In every ReadOut-Group I have 18 rows so I use the Rule Engine Node to mark the rows in my specific order and then just add with the Math Formular Node a multiple of 18. The multiple is exactly the value of the current iteration and that’s it.
Sometimes it’s much easier than you think :slightly_smiling_face: :upside_down_face:

2 Likes

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