generate 2 or more lines Rules for the 'Rules engine (dictionary)' by using StringManipulation Node

Hi there,
my problem sounds really easy for the KNIME Community and I cannot find anything supporting me in the documentation:
I want to formulate with the StringManipulation Node 2 liner Rules I can than use in Rule Engine (Dictionary) like:

$ColA$ = $ColB$ => “”
NOT $ColA$ = $ColB$ => $ColC$

I did it in that way:
join($ColA$, " = ", $ColB$, “=> “””)

Now my problem how do I get the ‘ENTER’ in, to get the second rule in line 2:
join($ColA$, " = ", $ColB$, “=> “”” ENTER NOT $ColA$ = $ColB$ => $ColC$
)

To achieve a new line, one could use a line break \r\n instead of ENTER, giving something like this:

join($ColA$, " = ", $ColB$, "=> \r\nNOT $ColA$ = $ColB$ => $ColC$")

Whether or not that will be understood by the Rule Engine node is another story.

1 Like

The String Manipulator already did not understand,

Hello @Sbremm,

and welcome to KNIME Community!

What exactly are you trying to accomplish? Can you explain it a bit more? Have rules dynamically constructed? Maybe Rule Engine (Dictionary) node is not a way.

Regarding new line in String Manipulation node here is expressions that works:

join("string1","\n","string2")

Br,
Ivan

Hi @ipazin,
Thank you for your warm welcome!
I found out, that rule engine (dictionary) is not the right one. I understood, that the flow variable input can be just a column name.
I have chosen now the Rule engine, there I can implement my dynamic rules containing flow variables, in my example ColA and B. I get the “enter” done like described, but rule engine is not accepting a 2 row string input via flow variable. If I sent 1 row, its running, with the 2nd row the error is marked at the red lights and it looks like that the full string is than taken asa column name.
My solution is now to add a 2nd rulengine and send 2 different rules ( one each rule engine) instead of 2 rules in one rule engine…

2 Likes

Hello @Sbremm,

glad you found a way.

This is because rules need flow variable type array (you can see this from an icon on the left on Flow Variables tab). To get it you need to combine your two string flow variables but currently it easier to use two Rule Engine nodes as you do than do above operation so I would advise to stay with it if works as expected and table is not humongous.

Br,
Ivan

1 Like

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