Rule Engine used for Formulas not String Solution

#1

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?

0 Likes

#2

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

0 Likes

#3

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.)

0 Likes

#4

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.

0 Likes

#5

For this purpose you need to use

1 Like

#6

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.

0 Likes

#7

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))

0 Likes

#8

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

#9

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

#10

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

Best,
Armin

1 Like

#11

OK, Thanks

0 Likes