Rule Engine, Dictionary, for multiple columns?

Hi!
So I have some kind of survey results.
Which means, I have to convert those answers into some pre-determined score.
Like,
$CAT1$ = 1 => 5
$CAT1$ = 2 => 3
$CAT1$ = 3 => 1

the problem is that those survey’s scores are not same for every questionaire.
So it can contain

$CAT2$ = 1 => 10
$CAT2$ = 2 => -10

at the same time.

Rule Engine (Dictionary) is the closest one I could find so far.
The problem is, I only can handle one column at a time.

I tried to make it work with loops but the thing is, I made one Dictionary for all columns.
which means, with loops, I have to split those dictionary for each column, but it’s inefficient.

I tried String replacer (multi column) as well, but since the scroe sheets are different per column, it’s no use.

There should be something to converts all those values in multiple column with different rule.

And I haven’t found yet.

Let me know if you have some idea. :slight_smile:
Otherwise, I’ll just prepare converted excel sheet or put python script in it.

Hi @knightas7,

I think the node you’re looking for might be the Column Expressions node. You might notice that the syntax is different to the rule engine, but it allows you to make transformations to multiple columns and combines the functionalities of the rule engine, math formula and string manipulation nodes.

Hope this helps! Best,
Karen

4 Likes

Thanks! Seems like it’s one of the recent updated node I guess, cuz I can’t find it in my Knime xD
I’ll take a look after when my work got cleaned!
I managed to make it with string replacer with loops, and just chunked them into component.
Many thanks!

Glad you got it to work otherwise! You can also check to see if you have the necessary extension installed (simply try dragging and dropping the node into your workflow from the Hub).

Best of luck!
Karen

2 Likes

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