<br> Sergey,<br><br> I don't think you will get the behavior you described, out of the box. What you can do, is delegate to the engine the actual update work.<br><br>rule "on updated cost write to archive old value"
<br> when<br> $cost : Cost( $oldAmount : amount )<br> $event : CostUpdateEvent( $newAmount : amount, object == $cost ) <br> then<br> //... write to archive $oldAmount
<br> $cost.setAmount( $newAmount );<br> update( $cost );<br> retract( $event );<br>end<br><br> Right now, shadow facts don't expose it's cache for use in rules in a safe way. So, I believe something like the above is the best approach.
<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/8/2, Manukyan, Sergey <<a href="mailto:SManukyan@lear.com">SManukyan@lear.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;">
<br>Folks,<br><br>I need a rule that will track changes to cost amount and do something<br>with his old value.<br><br>Like that :<br><br>rule "on updated cost write to archive old value"<br> when<br> cost : Cost()
<br> old_cost : Cost(amount != cost.amount) // how can I<br>specify the OLD cost object before it was updated???<br> then<br> ... write to archive $old_cost.amount<br>end<br><br><br>Is it possible at all?
<br><br>Something like in database system triggers, when you have "on update"<br>and then you have OLD value and NEW values available...?<br><br>Thanks a lot!<br><br>-Sergey<br><br><br><br>**********************
<br>** LEGAL DISCLAIMER **<br>**********************<br><br>This E-mail message and any attachments may contain<br>legally privileged, confidential or proprietary<br>information. If you are not the intended recipient(s),<br>
or the employee or agent responsible for delivery of<br>this message to the intended recipient(s), you are<br>hereby notified that any dissemination, distribution<br>or copying of this E-mail message is strictly<br>prohibited. If you have received this message in
<br>error, please immediately notify the sender and<br>delete this E-mail message from your computer.<br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><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>