<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2>I believe globals are to be used in the RHS of a rule and
not the LHS which uses "normal" facts.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2>I would suggest rule "AmountsAreNotNull" asserts new
objects that activate rule "CompareValue" or something
similar.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2>Saving variables between rules should be accomplished using
logically asserted facts.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2>I hope this helps.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=918120014-14062007><FONT face=Arial
color=#0000ff size=2>Mike</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Alexander
Komissarov<BR><B>Sent:</B> 14 June 2007 14:46<BR><B>To:</B>
rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] How to get value
of global variable from one rule toanother<BR></FONT><BR></DIV>
<DIV></DIV>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>Komissarov
Alexander<BR>mail: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:aleks.komissarov@gmail.com"
target=_blank>aleks.komissarov@gmail.com </A><BR>icq: 239128267</SPAN>
</BLOCKQUOTE></BODY></HTML>