<!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>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=051431713-03102007><FONT face=Arial 
color=#0000ff size=2>If you have not&nbsp;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>&nbsp;</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.&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 
  "QTY Percentage tolerance - Approval"<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 == "QTY", matchApprv == "Y", 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("QTY Percentage 
  tolerance - No Approval");<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  rtvHeader.setStatus(StatusConstants.APPROVAL );<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; System.out.println( "We have " + results.size() + 
  " Open RTV Lines" );<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( "line" 
  );<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 </BLOCKQUOTE></BODY></HTML>