<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<META content="MSHTML 6.00.6000.17023" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=630394312-03062010><FONT face=Arial
color=#0000ff size=2>Yes, you're right <FONT face=Tahoma color=#000000>Tihomir
Surdilovic</FONT><BR>your solution is way more elegant than
mine. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=630394312-03062010><FONT face=Arial
color=#0000ff size=2>And to <SPAN lang=FR>skasab2s: you should use a function to
avoid copy and paste three time the same then
clause</SPAN></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>De :</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>De la part de</B> Tihomir
Surdilovic<BR><B>Envoyé :</B> jeudi 3 juin 2010 14:40<BR><B>À :</B>
rules-users@lists.jboss.org<BR><B>Objet :</B> Re: [rules-users] Firing a
rule if at least its two conditions are satified<BR></FONT><BR></DIV>
<DIV></DIV>IMO you can just use activation groups and not have to deal with
incrementing, something like:<BR><BR>rule first<BR>activation-group
"myactgrp"<BR>when<BR> Condition A<BR> Condition
B<BR>then<BR>...<BR>end<BR><BR><BR>rule second<BR>activation-group
"myactgrp"<BR>when<BR> Condition A<BR> Condition
C<BR>then<BR>...<BR>end<BR><BR>rule third<BR>activation-group
"myactgrp"<BR>when<BR> Condition B<BR> Condition
C<BR>then<BR>...<BR>end<BR><BR>When one of these rules fire it will cancel the
activation of all other rules in the same activation group. You can also then
add salience to control rule priority.<BR><BR><BR>On 6/3/10 8:15 AM, PAYET,
Manuel wrote:
<BLOCKQUOTE
cite=mid:5104F06B63E3164FAEB2F42B920311654CB09B29@CORPMAIL05.corp.capgemini.com
type="cite"><PRE wrap="">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
cnt=cnt+1;
End
Rule "action 1, after everything"
Salience -10
When
        eval(cnt>=2)
Then
        execute action 1
End
Of course, if you change the fact, you'll probably have to think about things like lock-on-active to increment only one time the cnt variable
-----Message d'origine-----
De : <A class=moz-txt-link-abbreviated href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A> [<A class=moz-txt-link-freetext href="mailto:rules-users-bounces@lists.jboss.org">mailto:rules-users-bounces@lists.jboss.org</A>] De la part de skasab2s
Envoyé : jeudi 3 juin 2010 14:04
À : <A class=moz-txt-link-abbreviated href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>
Objet : [rules-users] Firing a rule if at least its two conditions are satified
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 you know how to implement this? Any ideas or hints?
Many thanks and regards!
skasab2s.
--
View this message in context: <A class=moz-txt-link-freetext href="http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.html">http://drools-java-rules-engine.46999.n3.nabble.com/Firing-a-rule-if-at-least-its-two-conditions-are-satified-tp867432p867432.html</A>
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>
<A class=moz-txt-link-freetext href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A>
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is
intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message
in error, please notify the sender immediately and delete all copies of this message.
_______________________________________________
rules-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>
<A class=moz-txt-link-freetext href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A>
</PRE></BLOCKQUOTE><BR><pre></PRE><p style="font-family:arial;color:grey" style="font-size:13px">This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.</p><PRE>
</pre></BODY></HTML>