<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>RE: Why not retracting?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">By way of an update; if the retraction is made within a different Agenda Group the rules work as expected.</FONT>
</P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">However the problem of the retraction having no obvious affect when operated within the same Agenda Group remains.</FONT>
</P>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Is this a bug?</FONT>
</P>
<UL>
<P><FONT SIZE=1 FACE="Tahoma">_____________________________________________ </FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">From: </FONT></B> <FONT SIZE=1 FACE="Tahoma">Anstis, Michael (M.) </FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">Sent: </FONT></B> <FONT SIZE=1 FACE="Tahoma">26 January 2007 11:32</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">To: </FONT></B> <FONT SIZE=1 FACE="Tahoma">'Rules Users List'</FONT>
<BR><B><FONT SIZE=1 FACE="Tahoma">Subject: </FONT></B> <FONT SIZE=1 FACE="Tahoma">Why not retracting?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Hello,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I have the following rules; one removes "Prices" that do not have the required "Economic Level" from working memory, the other calculates a "Costs":-</FONT></P>
<UL>
<P><FONT SIZE=2 FACE="Courier New">rule "Cost - remove prices that do not have the required 'Economic Level'"</FONT>
<BR><FONT SIZE=2 FACE="Courier New">agenda-group "stamping-costs"</FONT>
<BR><FONT SIZE=2 FACE="Courier New">//</FONT><FONT SIZE=2 FACE="Courier New">salience 1</FONT>
<BR><FONT SIZE=2 FACE="Courier New">when</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">p : Price ( economicLevel != ( Utilities.makeDate(1, 1, 2007) ) )</FONT>
<BR><FONT SIZE=2 FACE="Courier New">then</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">System.out.println("Retracting "+p.toString());</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">retract(p);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">end</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">rule "Cost - calculate cost for 'Stamping process' on a process"</FONT>
<BR><FONT SIZE=2 FACE="Courier New">agenda-group "stamping-costs"</FONT>
<BR><FONT SIZE=2 FACE="Courier New">//</FONT><FONT SIZE=2 FACE="Courier New">salience</FONT> <FONT SIZE=2 FACE="Courier New">2</FONT>
<BR><FONT SIZE=2 FACE="Courier New">when</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">r : ResourceEntry ( m : machine )</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">//</FONT><FONT SIZE=2 FACE="Courier New">p : Price ( economicLevel == ( Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">p : Price ( machine == ( m ) )</FONT>
<BR><FONT SIZE=2 FACE="Courier New">then</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">Cost cost = new Cost(r, p);</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">cost.setCost((float) (r.getUsage() * p.getRate()));</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">assert(cost);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">end</FONT>
</P>
</UL>
<P><FONT SIZE=2 FACE="Arial">The problem is that the "Cost" rule still works upon ALL "Prices" (even those with an incorrect "Economic Level").</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">If I change the line in the "Cost" rule to also check the "Economic Level" the rules work as expected (i.e. "Costs" are only calculated using "Prices" with an "Economic Level" of 01/01/2007).</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I've tried using "salience" levels too (as commented in the above Rules) but this doesn't have any effect either.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">What am I doing wrong?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Cheers,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Mike</FONT>
</P>
</UL>
</BODY>
</HTML>