# Rule Engine used for Formulas not String Solution

I have seen the examples used for the Rule Engine but nothing for conditional Formulas based on satisfying the rule for a condition. I am not disappointed with the String condition, but is there a Formula condition to satisfy the rule available? If not, is there a Work Around for the challenge?

Hi,
Iâ€™m not sure what exactly your issue is.
Would you please explain a bit more and provide some examples?
Armin

If I understand you correctly, you want to use the regular expressionsâ€™ groups in the result of the rule. That is not possible. As I remember when it was originally implemented the named groups were not supported by the bundled Java and would be also hard to refer to them when there are multiple regular expressions in the conditions. Also PMML Rulesets do not support formulae in the result. (Though I should add that adding support to this would probably not very hard, but would be hard to use/document in my opinion.)

Thanks so much.

I am looking at a challenge with the â€śRule Engine Nodeâ€ť
For Exampleâ€¦
//

When the values in Col0 are greater than 0, we [assign]

This is a comment \$Col0\$ > 0 => â€śPositiveâ€ť

When the values in Col0 = Active and less or equal to 5 then, we [assign]
\$Col0\$ = â€śActiveâ€ť AND \$Col1\$ <= 5 => â€śOutlierâ€ť

.
It appears to apply rules and will allow for the condition to be a â€śStringâ€ť like Positive or Outlier.

I am needing the condition to be a Formula from the Columns in the table instead.

When the values in Col0 are greater than 0, we [assign]

This is a comment \$Col0\$ > 0 => \$Col1\$ * 5

When the values in Col0 = Active and less or equal to 5 then, we [assign]
\$Col0\$ = â€śActiveâ€ť AND \$Col1\$ <= 5 => \$Col1\$ / \$Col4\$

Is there a node for this?
I was thinking that maybe I have to apply the Rule Engine 1st, then use the results of the Rule Engine to use a calculation from a certain column? I appreciate any insight into this challenge.

For this purpose you need to use

1 Like

Hi izaychik63,

Do you have any examples of how this would work? I canâ€™t seem to find any good examples of this in action. I found Column Expressions - NodePit
But I wondered if you know of any videos that walk thru the thought process? Thanks for your feedback, I find it to be on the right track.

Thanks for the help, I got a pulse with the Column Expression Node. Here is an exampleâ€¦

a=column(â€śpro_Arg1â€ť)
b=column(â€śpro_Arg2â€ť)
c=column(â€śpro_Arg3â€ť)
v=column(â€śValueâ€ť)
q=column(â€śQTYâ€ť)

if(isMissingÂ©)
q = (a)+((b)*(v))

if (a > 0)
q = (a)+((b)*(v)+(v/c))

The â€śColumn Expressionsâ€ť node suggested by @izaychik63 does exactly what you asked for.

Regarding your secondary question,

Take a look at this blog post:
https://blog.statinfer.com/knime-multitasking-with-column-expressions-node/

Best,
Armin

2 Likes

This was a very interesting, â€śDeep Diveâ€ť, thanks for sharing.
After getting the Column Expression to perform properly I am now down to formatting the data for output. I have a table made up of products that fall into Categories/Cphases/Uses. I am wanting to aggregate the data such that I have sub-Totals for each Category/Cphases and Grand Totals at the end. Do you know of any examples with this type of formatting for output data? Thanks againâ€¦

1 Like

Please create a new topic for this new question and provide an example of the input and your desired output.

Best,
Armin

1 Like

OK, Thanks

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