All,<br><br>I have the following function that I call from all of my rules. When I execute this function, I need to retract that object from working memory. 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 "QTY Percentage tolerance - Approval"<br> salience -25<br> no-loop true<br> when<br> rtvHeader : RtvHeader( totalAmount : totalAmount, status not in (
StatusConstants.MATCHED, StatusConstants.APPROVAL) )<br> repaymentCode : RepaymentCode( code == "QTY", matchApprv == "Y", tolDollar ==0, tolPercent != 0, tolPercent : tolPercent )<br> qtyOutput : QTYOutput( sumRTVQty : sumRTVQty , sumCmAndRnr : sumCmAndRnr )
<br> eval( qtyPercentage(qtyOutput, totalAmount, tolPercent) )<br> then <br> System.out.println("QTY Percentage tolerance - No Approval");<br> rtvHeader.setStatus(StatusConstants.APPROVAL
);<br> openRTVLines(drools.getWorkingMemory(), drools.getWorkingMemory().getQueryResults( "Open RTV Lines" ), StatusConstants.MATCHED_WITHIN_TOLERANCE);<br>end<br><br>function void openRTVLines(WorkingMemory workingMemory, QueryResults results, String status)
<br>{<br> System.out.println( "We have " + results.size() + " Open RTV Lines" );<br> for ( Iterator it = results.iterator(); it.hasNext(); ) {<br> QueryResult result = ( QueryResult ) it.next
();<br> DetailLine line = ( DetailLine ) result.get( "line" );<br> line.setStatus(status);<br> <br> // I need to add this in<br> // workingMemory.retract(line);<br> }<br>}<br>
<br>Thanks in advance,<br><br>Ron