<!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">
Mehdi wrote:
<blockquote cite="mid:34885.40429.qm@web54306.mail.re2.yahoo.com"
 type="cite">hi,<br>
  <br>
I have a class Customer.java with class variable "allTradeAmounts" and<br>
  <br>
I have two rules as follows:<br>
  <br>
rule "rule 1"<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $c : Customer();<br>
&nbsp;&nbsp;&nbsp; then <br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $c.setAllTradeAmounts($c.getAllTradeAmounts().add(1000));&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; System.out.println("after modify: "+$c.getAllTradeAmounts());<br>
</blockquote>
how does the engine know this has changed? call:<br>
update($c);<br>
<blockquote cite="mid:34885.40429.qm@web54306.mail.re2.yahoo.com"
 type="cite">end<br>
  <br>
rule "rule 2"<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $c : Customer(allTradeAmounts &lt; 200 );<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("AllTradeAmounts &lt; 200 ");<br>
  <br>
end<br>
  <br>
The rule 1 works fine and changes the value of this variable.<br>
My question is, although the rule 1 has changed the class variable and
I can see the result of changed variable EACH TIME, when i insert a
Customer object, why is the second rule TRUE? I have changed the value
of AllTradeAmounts and I can print it in RHS and it is more than 200,
but in LHS if I check with "allTradeAmounts &lt; 200 " ,it is true.<br>
It must be FALSE and does not fire the rule.<br>
can someone help me? what do I do wrong in LHS.<br>
In the same rule (rule 2) if I print the allTradeAmounts it is more
than 200.<br>
sorry it is a simple question, but I m new to drools.<br>
Thanks and regards <span style="text-decoration: underline;"></span>
  <p> </p>
  <hr size="1">Be a better sports nut! Let your teams follow you with
Yahoo Mobile. <a moz-do-not-send="true"
 href="http://us.rd.yahoo.com/evt=51731/*http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ">Try
it now.</a>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
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>