[rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread skasab2s
Hello, we are using Drools in our company. We have a rule with three conditions in this format: when Condition A Condition B Condition C then execute Action 1 Now we have a situation, in which the rule should fire if AT LEAST two of the three conditions are satisfied. Do

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread PAYET, Manuel
If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything Salience 10 When Eval(true) Then Cnt=0 End Rule condition A When condition A Then cnt=cnt+1; End Rule condition B When condition B Then cnt=cnt+1; End Rule condition C When condition B Then

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread Tihomir Surdilovic
IMO you can just use activation groups and not have to deal with incrementing, something like: rule first activation-group myactgrp when Condition A Condition B then ... end rule second activation-group myactgrp when Condition A Condition C then ... end rule third

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread PAYET, Manuel
Yes, you're right Tihomir Surdilovic your solution is way more elegant than mine. And to skasab2s: you should use a function to avoid copy and paste three time the same then clause De : rules-users-boun...@lists.jboss.org

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread Greg Barton
This will not work. Rules will not predictably react to changes in global variables. Use an object in working memory. GreG On Jun 3, 2010, at 7:15, PAYET, Manuel manuel.pa...@capgemini.com wrote: If I were you, I'd use something like Global java.lang.Integer cnt; Rule before everything

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread PAYET, Manuel
The solutions given are useable anyway, Thanks for this information GreG -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de Greg Barton Envoyé : jeudi 3 juin 2010 15:29 À : Rules Users List Objet : Re: [rules-users]

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread PAYET, Manuel
By the solutions given I didn't mean to tell mine was good, apparently it's not, I was talking about the other ones. -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de PAYET, Manuel Envoyé : jeudi 3 juin 2010 15:33 À :

Re: [rules-users] Firing a rule if at least its two conditions are satified

2010-06-03 Thread Moe Alkhafaji
I had to do something like this. The way I did it is by prividing a method in my object in working memory that takes multiple Boolean conditions and loops through them and return true if at least N of the conditions were true. So, this funtions will take N and a list of all conditions.