<br>&nbsp;&nbsp; Dirk,<br><br>&nbsp;&nbsp; This should work:<br><br> $rli_list : RecordSet( this != $npi.relatedRLIs )<br><br>&nbsp; If it is not working, may I ask you please to open a JIRA?<br><br>&nbsp; []s<br>&nbsp; Edson<br><br><br><div><span class="gmail_quote">2008/1/25, Dirk Bergstrom &lt;<a href="mailto:dirk@juniper.net">dirk@juniper.net</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I collect objects of type RLI that are related to instances of type NPI, and<br>&quot;attach&quot; them to their NPIs, and (in a later agenda group) collect subsets of<br>RLIs based on attributes of RLIs, NPIs, and other objects.&nbsp;&nbsp;In the first agenda<br>
group, I need to update() the NPI object after the new list of RLIs is attached,<br>but I only want to do this when a *new* list is attached.<br><br>The only way I can find to do this requires an eval.&nbsp;&nbsp;Is there a better way?<br>
<br>Here&#39;s the rule that I have now.&nbsp;&nbsp;This works:<br><br>rule &quot;RLIs for NPI&quot;<br> agenda-group &quot;010&quot;<br> lock-on-active true<br> salience 50<br>when<br> $npi : NPIRecord( )<br> $rli_list : RecordSet( eval( ! $rli_list.equals($npi.getRelatedRLIs())) ) from<br>
&nbsp;&nbsp;collect( RLIRecord( npi_program == $npi.synopsis ) )<br>then<br> $npi.setRelatedRecords($rli_list, DataSource.RLI);<br> update($npi);<br>end<br><br>I&#39;d like to write something like this:<br><br>...<br> $rli_list : RecordSet( $rli_list != $npi.relatedRLIs ) from<br>
...<br><br>But that doesn&#39;t compile.&nbsp;&nbsp;To get around that, I added a method called<br>getContents to RecordSet that just returns &quot;this&quot;, so I could write:<br><br>...<br> $rli_list : RecordSet( contents != $npi.relatedRLIs ) from<br>
...<br><br>But that always returns true.&nbsp;&nbsp;Best I can tell, it gets compiled into an<br>inequality test, as opposed to a call to equals(), and the new list is never the<br>same object as the old list, even though they may have the same contents.<br>
<br>I also tried this (setRelatedRecords returns true if the list is different):<br><br>...<br>then<br> $npi.setRelatedRecords($rli_list, DataSource.RLI) &amp;&amp; update($npi);<br>end<br><br>But that won&#39;t compile at all.<br>
<br>--<br>Dirk Bergstrom&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:dirk@juniper.net">dirk@juniper.net</a><br>_____________________________________________<br>Juniper Networks Inc.,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computer Geek<br>Tel: 408.745.3182&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax: 408.745.8905<br>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;JBoss Drools Core Development<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>