You really ought to read all the pertaining sections in the Drools Expert manual and experiment. Nobody can write complex rules without some exercise.<br><br><div class="gmail_quote">2010/2/24 dhari <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com">sdhari@hotmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">







<p>Thanks Jeffery. 
I&#39;ll try this but what if I have more complex condition e.g. </p>

<p><br>
Order ($discount : discount, $items : items)<br>
Item(grade &gt; 3 &amp;&amp; (quantity &lt; 5 || $discount &gt; 10)) from $items</p></blockquote><div><br>Again, you are using a condition on discount not next to the field in the fact where it occurs (i.e., Order); it&#39;s just not possible to write it this way.<br>
<br>Order( discount &gt; 10, $items : items )   # all Orders where discount &gt; 10 <br>Item( grade &gt; 3, quantity &lt; 5 ) from $items # and each of its Items where grade &gt; 3 and quantity &lt; 5<br><br>There is no need to use &amp;&amp; to combine two conditions for the same fact.<br>
<br>Now if you need to detect Order Items with grade &gt; 3 where either the quantitiy of the Item is &lt; 5, or  the Order&#39;s discount &gt; 10, (or both) you&#39;d have to write<br><br>Order( $discount : discount, $items : items )   # all Orders<br>

Item( grade &gt; 3, $quantity : quantity) from $items # and each of its Items where grade &gt; 3<br>eval( $discount &gt; 10 || $quantitiy &lt; 5 ) # and discount &gt; 10 or quantity &lt; 5 (or both)<br>
<br>-W<br><br><br></div></div><br>