[rules-users] How to get value of global variable from one rule to another

Edson Tirelli tirelli at post.com
Fri Jun 15 10:33:52 EDT 2007


   Alexander,

   Remember that the LHS is always evaluated at assert time and RHS is
always executed at rule firing time. So, when you change something at rule
firing time that you want to cause a reevaluation of the LHS, you must
notify the engine calling "modify":


map.put("result",res);
map.put("result2",res2);

modify( map );


    []s

    Edson




Also, I've tried to map these values in the
>
> rule "AmountsAreNotNull" salience 20
>     when
>        ...
>     then
>
> ...
>
> <res, res2 initialization>
>
> map.put("result",res);
> map.put("result2",res2);
> ...
>
> and check it in the next rule:
>
> rule "CompareValues" salience 10
>
> when
> map : Map( keySet contains "result" )
>
> ...
>
> "keyset" couldn't found "result" and "result2" mapping
>
> but! when I've checked "keyset" in RHS part of this rule "keyset" HAS
> proper values of "result" and "result2":
>
> ...
>
> then
>
> Iterator k = map.keySet().iterator();
>         while (k.hasNext())
>         {
>             String key = k.next().toString();
>             LOGGER.info("Key: " + key + "; Value: " + map.get
> (key).toString());
>         }
>
> ...
>
> end
>
> How I can check values of "result" and "result2" in LHS part of rule
> "CompareValues"?
> Thanks,
> ____________________
> Regards,
> Komissarov Alexander
> mail: aleks.komissarov at gmail.com
> icq: 239128267
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070615/a8052cd9/attachment.html 


More information about the rules-users mailing list