<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
IMO you can just use
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
activation groups and not have to deal with incrementing, something
like:<br>
<br>
rule first<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
activation-group "myactgrp"<br>
when<br>
&nbsp;&nbsp; Condition A<br>
&nbsp;&nbsp; Condition B<br>
then<br>
...<br>
end<br>
<br>
<br>
rule second<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
activation-group "myactgrp"<br>
when<br>
&nbsp;&nbsp; Condition A<br>
&nbsp;&nbsp; Condition C<br>
then<br>
...<br>
end<br>
<br>
rule third<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
activation-group "myactgrp"<br>
when<br>
&nbsp;&nbsp; Condition B<br>
&nbsp;&nbsp; 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&gt;=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&eacute; : jeudi 3 juin 2010 14:04
&Agrave; : <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>
</body>
</html>