I have now tried the following and it did not seem to have the intended result of removing the detail line from working memory:<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; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Now retract those objects from Working Memory<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FactHandle[] handles = 
result.getFactHandles();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(&quot;handles.length : &quot; + handles.length);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(int i = 0; i &lt; handles.length; i++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(&quot;Retracting : &quot;);
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; workingMemory.retract(handles[i]);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>Any other thoughts out there?<br><br><div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Ronald R. DiFrango</b> &lt;<a href="mailto:ron.difrango@gmail.com">
ron.difrango@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Michael,<br><br>Those detail lines are in working memory for sure.&nbsp; In fact the query it self only works on working memory objects.
<br><br>As far as I know you can not place the results of a queryResult in the LHS.<br><br>
Ron<div><span class="e" id="q_115660dcf9c20285_1"><br><br><div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Anstis, Michael (M.)</b> &lt;<a href="mailto:manstis1@ford.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
manstis1@ford.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Can you not get a reference to a DetailLine in the 
LHS?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">If you have inserted DetailLine&#39;s into working memory what 
does query &quot;Open RTV Lines&quot; return, can it be joined into the LHS? (or split 
into two rules)?</font></span></div><br>
<blockquote style="margin-right: 0px;">
  <div dir="ltr" align="left" lang="en-us">
  <hr>
  <font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a> 
  [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>] <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><span>
  <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 
  &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 </span></div></blockquote></div>
<br clear="all"></blockquote></div><br>
</span></div></blockquote></div><br>