<br>&nbsp;&nbsp;&nbsp; No, you can&#39;t retract the fact like that, for several reasons. Why would you want to do that?<br><br>&nbsp;&nbsp;&nbsp; If you are using the SLS_SLES_DTLS for this rule, and you don&#39;t want to keep them in memory for other rules, you can use&nbsp; &quot;from&quot; to pull them on-demand. Another option is that you can write another rule that retract your facts, with a lower salience, but you will have to use lock-on-active to avoid the accumulate rule being re-activated after the retraction of your facts.<br>
<br>&nbsp;&nbsp;&nbsp; One more comment, not related to your question, but I think it is a good example. Most people don&#39;t know that accumulate functions can take expressions as the parameter. So, instead of using a custom accumulate code like you have in your rule, would be simpler to just use the sum() accumulate function with an expression. Using java dialect as it seems you are, it would be:<br>
<br>&nbsp;&nbsp;&nbsp; brand_total:Number(doubleValue &gt;=1500)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from accumulate ( sa:SLS_SALES_DTLS( PK!=null, PK.ITEM_ID.BRAND_CD.BRAND_CD==&quot;N00&quot; ) ,&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum( sa.getTRN_QTY()* sa.getPK().getITEM_ID().getSALES_TO_BASE_CONV() ) )<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp; With MVEL, it would be a bit cleaner:<br><br>&nbsp;&nbsp;&nbsp; brand_total:Number(doubleValue &gt;=1500)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from accumulate ( sa:SLS_SALES_DTLS( PK!=null, PK.ITEM_ID.BRAND_CD.BRAND_CD==&quot;N00&quot; ) ,&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum( sa.TRN_QTY * sa.PK.ITEM_ID.SALES_TO_BASE_CONV )<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp; Hope it helps.<br><br>&nbsp;&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><br><br><div class="gmail_quote">2009/1/26 niraj manandhar <span dir="ltr">&lt;<a href="mailto:regniraj@gmail.com">regniraj@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Can i retract the objects from accumulate function<br>rule &quot;Brand base free Item &quot;<br>salience 10<br>when<br>&nbsp;&nbsp;&nbsp; brand_total:Number(doubleValue &gt;=1500)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from accumulate ( sa:SLS_SALES_DTLS( <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PK!=null,<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PK.ITEM_ID.BRAND_CD.BRAND_CD==&quot;N00&quot;<br>&nbsp;&nbsp;&nbsp; ) ,&nbsp;&nbsp;&nbsp; init ( double single_total=0; ),<br>&nbsp;&nbsp;&nbsp; action (single_total=single_total+(sa.getTRN_QTY()*<br>&nbsp;&nbsp;&nbsp; sa.getPK().getITEM_ID().getSALES_TO_BASE_CONV()<br>// I want to retract the sa over here<br>

<br>);<br>&nbsp;&nbsp;&nbsp; ),<br>&nbsp;&nbsp;&nbsp; result (single_total&nbsp; ) );<br>then<br>double item_discounted=brand_total.doubleValue()/&nbsp;&nbsp;&nbsp; 1500;<br>System.out.println(&quot;The discount given qty &quot;+item_discounted+&quot; multiplied slot 10&quot;);<br>

double item_left=brand_total.doubleValue()%1500;<br>if(item_left&gt;=1)<br>{<br>doit(item_left,&quot;N00&quot;);<br>}<br>end<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>