How to set priorities on columns

Hello!

I am trying to do something like this:

image

For example, a student has taken different tests in one year, but I want to create a new column categorizing them by the best result he has got.

If he has taken 4 tests and he got 3 Bad results but 1 Excelent, I want the 4 rows to show Excelent on the new column.

Excelent > Good > Bad

Hi, You can use the GroupBy node to group by Name column and use the Aggregation function Concatenate to concatenate the Test Result column. After this, you can have a Rule engine where you can test for the presence of “Excelent”, “Good”, “Bad” as three separate rules in this order and create a column Categorie with these values. Finally, use a Cell Replacer node to fill the input table with the assigned Categorie value.
Best
how_to_set_priorities_on_columns.knwf (12.2 KB)

Hi @NathanDrake , it’s probably safer to do this using a unique identifier, for example a student id, rather than names.

There are a few different ways to do this. I choose to use the Duplicate Row Filter and the Joiner nodes to do this. It might be the fastest way actually (as in execution/processing).

In my example, I have also introduced a Student ID with 2 different students having the same name:
image

Here’s the results, with the 2 different “Adam” getting their own Categorie:
image

This is what my workflow looks like:
image

Here is the workflow: Choose best categorie per student.knwf (13.5 KB)

2 Likes

I really appreciate it! @bruno29a It worked! :fist_right:

No problem @NathanDrake , happy to help

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