Thanks for your response Greg. As you said this is what i tried to fix the issue by creating a UserResult obj that has score as a property and inserting the same in working memory. I update the results in subsequent rules in the "then" clause. There are some issues that i faced in this as well :-
-- In my last rule if i want to do a check on score property of my result object in the "when" clause the score has not been updated . -- however if i do the same check in the "then" clause it seems to work properly. -- I tried to overcome by doing an update in one of my rules to check if that would work. That however went into an infinite loop. So i used the "lock-on-active true" property . However it seemed to work well for only the first user object and doesn't work for other user objects that are loaded later. Below is the sample rule file . If the scenario is not clear pls do let me know and i will send across the different drls as attachments . salience 200 when User ($id : id) then UserResult urslt = new UserResult ($id); insert ($id) end salience 100 lock-on-active truewhen $usr : User (language.keySet contains "Japanese", $j_score : language["Japanese"]) $urslt : UserResult (id == $usr.id) then $usrlt.setLangScore("Japanese", $j_score); end salience 50 lock-on-active truewhen User (language.keySet contains "French", $f_score : language["French"]) $urslt : UserResult (id == $usr.id) then $usrlt.setLangScore("French", $_score); update ($usrlt); end salience 25 when UserResult (score > 4) // does not work then // if ($usr_rslt.getScore() > 4) --> works well // update the db end Regards, Manav ----- Original Message ---- From: Greg Barton <greg_bar...@yahoo.com> To: Manav <manav7...@yahoo.com>; Rules Users List <rules-users@lists.jboss.org> Sent: Thu, August 12, 2010 9:29:28 PM Subject: Re: [rules-users] Caching results in temperory variables You must either update an existing working memory object or insert a new working memory object with the results. That's how rules communicate with each other. GreG On Aug 12, 2010, at 10:31 AM, Manav <manav7...@yahoo.com> wrote: Hi, I am using the version 5.x of drools and i have a scenario where i want to hold the result of a test in one rule to a temperory variable . This result will then be used in another rule that will be fired later in the sequence . For ex : salience 100 when User (language.keySet contains "Japanese", $j_score : language["Japanese"]) then // do something end salience 50 when User (language.keySet contains "French", $f_score : language["French"]) then // do something end salience 25 when eval (($j_score + $f_score) > 4) then // update the same to db end Is this possible in Drools 5.x ? Regards, Manav _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users