<br> Globals are intended to provide a way to pass values in and out of the engine. Not for reasoning and exchange of values between rules.<br> Values that are changed by rules and are reasoned over are clearly facts of your domain and should be modeled as such.
<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/6/14, Alexander Komissarov <<a href="mailto:aleks.komissarov@gmail.com">aleks.komissarov@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>Please give me advice for best way storing global variables.<br><br>global java.lang.Integer res;<br>global java.lang.Integer res2;<br>...<br><br>I've several number of rules. One rule has variable initialization
e.g.:<br><br>...<br>rule "AmountsAreNotNull" salience 20<br> when<br> < conditions ><br> then<br> ...<br> res = new Integer(a.compareTo(new BigDecimal(25)));<br> res = (res == -1)?0:res;
<br> res = (res == -1)?0:res;<br> res2 = new Integer(a.compareTo(b));<br> res2 = (res2 == -1)?0:res2;<br> ...<br>end<br><br>The values of these variables are proper and equal 1<br><br>Then next rule has comparing for res|res2 values, but they have lost their values (res == null and res2 == null)
<br><br>rule "CompareValues" salience 10<br> when<br> res:Integer(intValue == 0)<br> res2:Integer(intValue == 0)<br> result:List()<br> then<br> result.add(Boolean.TRUE);<br>end
<br clear="all">
<br>What decision you can advise me to save variables value between rules?<br>Thanks.<br>____________________<br>Regards,<br><span class="sg"><span>Komissarov Alexander<br>mail: <a href="mailto:aleks.komissarov@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
aleks.komissarov@gmail.com
</a><br>icq: 239128267</span>
</span><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>