Rule engine most silly question ever...

This is probably the simplest question ever. I am trying to use the rule engine to make a concat. between a string and a string column. I keep getting a syntax error but can’t find information about how to do it correctly.

@Dino,

For sure that’s by far no silly question.
Unfortunately I can’t help solving that error message.
I tend to use the Column Expression Node Column Expressions — NodePit
You might use an expression like

if (column(“Type”) == 20) column(“GLAccount”) + “YourText”

HTH

4 Likes

I think in this case I would just assign the flag with a Rule Engine, and use a subsequent String Manipulation node to actually concatenate the leading Text bit.

2 Likes

What do you mean with flag with a Rule Engine?
Thanks for your input!

I forgot about the expression node. Thanks.
But is there somewhere information about the syntax for the rule engine? Or am i trying to force the rule engine in something it can’t do?

Hi @Dino,

as far as I know it is not possible to do this with the Rule Engine.
Only with extra nodes (like @ScottF suggested)
Or if you want to do it with one node you have to use the expression node (like @knimediger said).

…it seems like you cannot do any calculations/string manipulations in the rule engine itself

The syntax for the expression node is like a JavaScript if

syntax is like this
if(FirstTrueFalseCheck) {
//return value for true
} else if (secondTrueFalseCheck) {
//return value for true
} else {
// do that/return this if evaluates to false
}

2 Likes

You can find the syntax for rules here: https://github.com/knime/knime-javasnippet/blob/analytics-platform/4.2.2/org.knime.jsnippets/src/org/knime/base/node/rules/engine/SimpleRuleParser.java#L66-L97 (but probably the previously linked documentation is also sufficient).
The rule engines do not support non-logical expressions, so you cannot concatenate strings with it. In case you need that, there are other expressions you might want to consider.
I think what @ScottF suggested was a new column whether you need the transformation and based on that in the String manipulation node you can use the actual transformation (like $signalColumn$ ? (transformed expression) : $otherColumn$)

1 Like

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