All,<br><br>I have the following function that I call from all of my rules.&nbsp; When I execute this function, I need to retract that object from working memory.&nbsp; The problem is that when I insert the comment line below I get a compiler error saying that I can only issue a retract on fact handles.
<br><br>Here is an example of my rule plus the function:<br><br>rule &quot;QTY Percentage tolerance - Approval&quot;<br>&nbsp;&nbsp;&nbsp; salience -25<br>&nbsp;&nbsp;&nbsp; no-loop&nbsp; true<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvHeader : RtvHeader( totalAmount : totalAmount, status not in (
StatusConstants.MATCHED, StatusConstants.APPROVAL) )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; repaymentCode : RepaymentCode( code == &quot;QTY&quot;, matchApprv == &quot;Y&quot;, tolDollar ==0, tolPercent != 0, tolPercent : tolPercent )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; qtyOutput : QTYOutput( sumRTVQty : sumRTVQty , sumCmAndRnr : sumCmAndRnr )
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; eval( qtyPercentage(qtyOutput, totalAmount, tolPercent) )<br>&nbsp;&nbsp;&nbsp; then <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(&quot;QTY Percentage tolerance - No Approval&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rtvHeader.setStatus(StatusConstants.APPROVAL
);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; openRTVLines(drools.getWorkingMemory(), drools.getWorkingMemory().getQueryResults( &quot;Open RTV Lines&quot; ), StatusConstants.MATCHED_WITHIN_TOLERANCE);<br>end<br><br>function void openRTVLines(WorkingMemory workingMemory, QueryResults results, String status)
<br>{<br>&nbsp;&nbsp;&nbsp; System.out.println( &quot;We have &quot; + results.size() + &quot; Open RTV Lines&quot; );<br>&nbsp;&nbsp;&nbsp; for ( Iterator it = results.iterator(); it.hasNext(); ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; QueryResult result = ( QueryResult ) it.next
();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DetailLine line = ( DetailLine ) result.get( &quot;line&quot; );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; line.setStatus(status);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // I need to add this in<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // workingMemory.retract(line);<br>&nbsp;&nbsp;&nbsp; }<br>}<br>
<br>Thanks in advance,<br><br>Ron