From: "Edson Tirelli" <[EMAIL PROTECTED]>
To: "Rules Users List" <[email protected]>
Date: Fri, 15 Jun 2007 11:33:52 -0300
Subject: Re: [rules-users] How to get value of global variable from one
rule to another

   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: [EMAIL PROTECTED]
> icq: 239128267
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> 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


Thank you for advice, but unfortunately,

using modify(map) in the rule "AmountsAreNotNull" cause difficulties like
infinite loop execution all previous rules INCLUDING this rule and EXCLUDING
final compare rule.

____________________
Regards,
Komissarov Alexander
mail: [EMAIL PROTECTED]
icq: 239128267
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to