<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial
color=#0000ff size=2>Can you not get a reference to a DetailLine in the
LHS?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial
color=#0000ff size=2>If you have not inserted DetailLine objects into
working memory how can you expect to retract them?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial
color=#0000ff size=2>If you have inserted DetailLine's into working memory what
does query "Open RTV Lines" return, can it be joined into the LHS? (or split
into two rules)?</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Ronald R.
DiFrango<BR><B>Sent:</B> 03 October 2007 14:01<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> [rules-users] Retract in a
function<BR></FONT><BR></DIV>
<DIV></DIV>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 </BLOCKQUOTE></BODY></HTML>