Rule Enigne from mutiple columns

Hello everyone.

I am trying to write a rule using the rules engine with multiple columns to replace column.

$DRIVE_NUMBER$ = “1” AND $DISTANCE$ = “10” AND $DOWN$ = “1” => “P”

I am trying to replace rows in the $DOWN$ column that contain “1” with “P”. YES, it worked but NOW all of the other ROWS in the $DOWN$ column now contain a ?.

Does anyone have any suggestions?
Thanks in advance.

Hi @willanalyze,

Welcome to KNIME community.

As mentioned by @ana_ved, there are many paths that led to Rome in KNIME, we can use multiple approach to achieve this.

I would request you to provide some sample data, so that others can suggest the accurate and possible best solution for your issue.

Best Regards,
Pavan

1 Like

Hi @willanalyze,

When you create a rule in the rule engine node, the node will execute that single rule. If there are rows that do not accept that rule or do not comply to that rule, they will become missing values (the ? you mentioned) unless you explicitly say what value they should take. Because you have rows that do not follow the rule you created ($DRIVE_NUMBER$ = “1” AND $DISTANCE$ = “10” AND $DOWN$ = “1” => “P”) KNIME then attributes a missing value for them.

If you want that all rows that are not “P” become “Q”, for instance, you could add the following rule:
TRUE => “P”

This is the same as to say “anything else that does not obey my rule should become Q”.

But this is just one of the ways, and as said before by pawanmtm-- multiple ways lead to Rome in KNIME.

I hope this helps!

Ana

1 Like

@ana_ved Thanks for the feedback. I applied your logic and it worked.

Ok, so how would I create a rule that says

“anything else that does not obey my rule should NOT change” OR another way of saying it
“anything else that does not obey my rule should KEEP its original value”

Thanks in advance

hi @willanalyze

the trick would be to use

TRUE => $DOWN$ (same as saying - anything else outputs the original values in the column Down).

Let me know if it works!

Cheers,
Ana

2 Likes

Executed perfectly. Thanks a bunch @ana_ved

1 Like

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