Michael,<br><br>In my case, I am modifying the object, so I thought a modifyRetract was the better option.<br><br>As for the differences, I will defer to the Drools team. Please note that CC'ed the group again as you did not on my response.
<br><br>Ron<br><br><div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Anstis, Michael (M.)</b> <<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>> 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">Thanks for posting the solution!</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Does it work with just "retract" rather than
"modifyRetract"?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Could the Drools' team remind me (the group) of the
difference between the two?</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> Ronald R. DiFrango
[mailto:<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@gmail.com</a>] <br><b>Sent:</b> 03 October 2007
14:57<br><b>To:</b> Anstis, Michael (M.)<br><b>Cc:</b> Rules Users
List<br><b>Subject:</b> Re: [rules-users] Retract in a
function<br></font><br></div><div><span class="e" id="q_1156633e6f09875d_1">
<div></div>I got it, the following works:<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> // Now retract those objects from
Working Memory<br> FactHandle handle =
workingMemory.getFactHandle(line);<br>
System.out.println("handle : " + handle);<br>
workingMemory.modifyRetract(handle);<br>
}<br>}<br><br>
<div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Ronald R.
DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@gmail.com</a> >
wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I
have now tried the following and it did not seem to have the intended result
of removing the detail line from working memory: <span><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></span> // Now retract those
objects from Working Memory<br>
FactHandle[] handles = result.getFactHandles();<br>
System.out.println("handles.length : " +
handles.length);<br> for(int i = 0; i
< handles.length; i++)<br>
{<br>
System.out.println("Retracting : "); <br>
workingMemory.retract(handles[i]);<br>
}<br> }<br>}<br><br>Any other thoughts out there?
<div><span><br><br>
<div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Ronald R.
DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ron.difrango@gmail.com</a>> 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. 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><br><br>
<div><span class="gmail_quote">On 10/3/07, <b class="gmail_sendername">Anstis,
Michael (M.)</b> <<a href="mailto:manstis1@ford.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> manstis1@ford.com</a>>
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> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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 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. 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
</span></div></blockquote></div><br clear="all"></blockquote></div><br></span></div></blockquote></div><br></span></div></blockquote></div><br></span></div></blockquote></div>
<br clear="all"></blockquote></div><br>