Sort strings in a table with missing values.

Hey everyone,

i just started using Knime and I want to sort a table with strings.

I also attached an excel file with my table (input) and how i want to rearrange the table (output).
So basically i would like to have all targets 1 in a column, all targets 2 in a column and so on, but still keep the missing values, if that makes sense.

Untitled 4…xlsx (5.9 KB)

Thanks for your help.
Palle

Hello @pallehh,

and welcome to KNIME Community!

There are many ways to do this in KNIME but one Rule Engine node for each column/target word seems like a good approach if you don’t have much more than 4 columns and target words are not changing all the time.

So you go from back and in first Rule Engine you’ll have following syntax:

$column4$ = "target4" => "target4"
$column3$ = "target4" => "target4"
$column2$ = "target4" => "target4"
$column1$ = "target4" => "target4"

with option to replace column4.

Then in next Rule Engine you’ll have following syntax:

$column3$ = "target3" => "target3"
$column2$ = "target3" => "target3"
$column1$ = "target3" => "target3"

with option to replace column3. And so on…

Give it a try and if you’ll have any questions/issues feel free to ask.

Br,
Ivan

3 Likes

Thanks a lot, it works!
Br,
Palle

2 Likes

one more question: could you do the same with the Column expressions node?

Br,
Palle

Sure @pallehh. Then you’ll have only one node with multiple expressions. Take a look here on how to write if else with Column Expressions node:

Br,
Ivan

3 Likes

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