<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">You're doing nothing wrong.&nbsp; At least, as long as you want it to print twice.&nbsp; :)&nbsp; Two activations are put on the agenda because both patterns (X+Y and X+Z) are in working memory.<br><br>Probably your best bet is to split it into two rules in an activation-group.<br><br>rule "Cannot select X if both Y and Z are not selected"<br>activation-group foo<br>
when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Item(code == "X")&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not Item(code == "Y")<br>
then<br>
&nbsp;&nbsp;&nbsp; System.out.println("Error: You cannot select X unless both Y and Z are selected");<br>
end<br><br>rule "Cannot select X if both Y and Z are not selected"<br>
activation-group foo<br>

when<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Item(code == "X")&nbsp;&nbsp;&nbsp; <br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not Item(code == "Z")<br>

then<br>

&nbsp;&nbsp;&nbsp; System.out.println("Error: You cannot select X unless both Y and Z are selected");<br>

end<br><br>Activation of one rule will prevent activation of the other one, resulting in only one error message.<br><br>--- On <b>Mon, 12/1/08, Vithal Kuchibhotla <i>&lt;vithalklrk@rediffmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Vithal Kuchibhotla &lt;vithalklrk@rediffmail.com&gt;<br>Subject: [rules-users] Action firing twice<br>To: rules-users@lists.jboss.org<br>Date: Monday, December 1, 2008, 11:20 PM<br><br><div id="yiv68784014">Hello All,<br><br>I have a list of Items that I am inserting into working memory. Here is the rule that is failing:<br><br><span style="font-family: Courier New,Courier,mono;">rule "Cannot select X if both Y and Z are not selected"</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">when</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier
 New,Courier,mono;">&nbsp;&nbsp;&nbsp; Item(code == "X")</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">&nbsp;&nbsp;&nbsp; (or (not Item(code == "Y"))</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (not Item(code == "Z")))</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">then</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">&nbsp;&nbsp;&nbsp; System.out.println("Error: You cannot select X unless both Y and Z are selected");</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">end</span><br><br>This rule works correctly when X and Y are there, and when X and Z are there. However, when both Y and Z are missing, the
 error prints twice. Can anyone tell me what I am doing wrong.<br><br>Thanks a lot<br>Vithal<br>
<br><table style="font-family: Verdana; font-size: 11px; line-height: 15px;" border="0" cellpadding="0" cellspacing="0" height="57" width="644"><tbody><tr><td><a rel="nofollow" target="_blank" href="http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-default.htm/1050715198@Middle5/2206641_2199021/2201651/1?PARTNER=3&amp;OAS_QUERY=null"><img src="http://imadworks.rediff.com/cgi-bin/AdWorks/adimage.cgi/2206641_2199021/creative_2201651.gif" alt="Rediff Shopping" border="0"></a></td></tr></tbody></table></div><pre>_______________________________________________<br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></pre></blockquote></td></tr></table><br>