Hi All,

I have one Scenario to achieve,Please find the screen shot for the same. KIndly assist me on this.

You could assign flags to individual rows using the Rule Engine node. Then, use a GroupBy node with grouping on your new flags, and sum aggregation.

I think that should work for your first 3 rules. I’m not sure I understand the 4th one, but it looks like just the overall (ungrouped) sum.

Hi @sahil786,

I think you can do that with

or the

Basically one Rule Engine for each of your rules, then use the groupby node to Aggregate the value of each sum

Maybe lastly use math formula for the rule4

Hi ,

Thank u for the response ,I have achieved the scenario for first three rules but for the fourth rule i am unable to write it in rule engine.How math formula Node can help here .Fourth rule is the aggregation of the above three rule only.How can i write it in rule engine?

It would be really helpful if You guys will help.

Hi @sahil786,

after you created the first 3 rules, use the Math Node to Aggregate the values with thr Results of Rule1+Rule2+Rule3

Hi ,

My Group by Node output is

Rule1|300

Rule2|700

Rule3|1100

Now in Math node i have applied col_sum(columname) which gave me below output

I want output as

Rule1|300

Rule2|700

Rule3|1100

Rule4|2100

I am not sure where to write the fourth rule,Ideally it should be in Rule engine itself but it is not allowing me to wrote such rule.

Also I dont want my solution to be data driven.For eg

my current input dataset is

R|Balance

40|100

40|200

50|300

50|400

110|500

110|600

if i add one more row in it

120|1000

and modify my rules to

$R$=40 => “Rule1”

$R$=50 => “Rule2”

$R$=110 => “Rule3”

Rule4=>Rule1+Rule2+Rule3(currently I am unable to write it)

$R$=120 => “Rule5”

Then How will i achieve it??

Hi @sahil786,

attached an example with Rule1-4

KNIME_project24.knwf (12.7 KB)

also should Rule1 not be R<=50 AND Rule3 <=100?

Hi,

I have done it with this approach.Please have a look on the same.

Data I/P

|40|100|

|40|200|

|50|300|

|50|400|

|110|500|

|110|600|

|140|1000|

|140|2000|

|150|3000|

|150|4000|

|210|5000|

|210|6000|

RULE I/P

|Rule1|r=40|

|Rule2|r=50|

|Rule3|r=110|

|Rule4|Rule1+Rule2+Rule3|

|Rule5|r=140|

|Rule6|r=150|

|Rule7|r=210|

|Rule8|Rule5+Rule6+Rule7|

Final o/p

|Rule1|300|

|Rule2|700|

|Rule3|1100|

|Rule4|2100|

|Rule5|3000|

|Rule6|7000|

|Rule7|11000|

|Rule8|21000|

KNIME_project.knwf (26.9 KB)

Thanks a lot for the guidance