<!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>Why not retracting?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Hello,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I have the following rules; one removes &quot;Prices&quot; that do not have the required &quot;Economic Level&quot; from working memory, the other calculates a &quot;Costs&quot;:-</FONT></P>
<UL>
<P><FONT SIZE=2 FACE="Courier New">rule &quot;Cost - remove prices that do not have the required 'Economic Level'&quot;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">agenda-group &quot;stamping-costs&quot;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">System.out.println(&quot;Retracting &quot;+p.toString());</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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 &quot;Cost - calculate cost for 'Stamping process' on a process&quot;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">agenda-group &quot;stamping-costs&quot;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">r : ResourceEntry ( m : machine )</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">p : Price ( machine == ( m ) )</FONT>

<BR><FONT SIZE=2 FACE="Courier New">then</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">Cost cost = new Cost(r, p);</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">cost.setCost((float) (r.getUsage() * p.getRate()));</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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 &quot;Cost&quot; rule still works upon ALL &quot;Prices&quot; (even those with an incorrect &quot;Economic Level&quot;).</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">If I change the line in the &quot;Cost&quot; rule to also check the &quot;Economic Level&quot; the rules work as expected (i.e. &quot;Costs&quot; are only calculated using &quot;Prices&quot; with an &quot;Economic Level&quot; of 01/01/2007).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I've tried using &quot;salience&quot; 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>

</BODY>
</HTML>