<br>&nbsp;&nbsp; Hi there,<br><br>&nbsp;&nbsp; Best to understand your needs before suggesting, but working simply on syntax, if you are using trunk, you can do this:<br><br>rule &quot;findRelevantResult&quot;<br> &nbsp; &nbsp; &nbsp; &nbsp;when<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$resultat : Resultat( ( 
results.size() &gt; 0 ) )<br><div style="direction: ltr;">&nbsp; &nbsp; &nbsp;&nbsp; then<br>&nbsp; &nbsp; &nbsp;&nbsp; end<br><br>rule &quot;testPsaId&quot;<br> &nbsp; &nbsp; &nbsp; &nbsp;when<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$prestation : Prestation(id == &quot;psaId&quot;)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$prestationFacturable : PrestationFacturable (prestation==$prestation, $resultat : resultat)
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$result : Result ( doubleValue &lt; 12 )<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Resultat ( this == $resultat , results contains $result )<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Utilisateur ( ( age &lt; 55 || sex != HumanSexType.MALE) )<br> &nbsp; &nbsp; &nbsp; &nbsp;then
<br>&nbsp; &nbsp; &nbsp;&nbsp; end</div><br>&nbsp;&nbsp; Ok, now I made things confuse right? :) Next step for us to get rid of the double &quot;(&quot; when using only a single predicate.<br>&nbsp;&nbsp; Anyone willing to help document and explain the above?<br>
<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2007/4/6, JLL &lt;<a href="mailto:jll@labocollard.be">jll@labocollard.be</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;">
<br>Hi all,<br><br>i&#39;m quiet new in drools (a french speaking so i appologise for my english<br>mistakes) and i&#39;m surprise by the folowing problem<br>in drools example i found this code ...<br><br>Example 3.14. Return Value operator
<br><br>Person( girlAge : age, sex == &quot;F&quot; )<br>Person( age == ( new Integer(girlAge.intValue() + 2) ), sex == &#39;M&#39; )<br><br>This let me think that i can use method of an assigned variable in the<br>equality test
<br><br>this my rule file<br><br>package be.labocollard.server.rules ;<br><br>import java.lang.Integer;<br>import java.lang.Double;<br><br>import be.labocollard.server.types.HumanSexType;<br>import be.labocollard.server.entities.Result
;<br>import be.labocollard.server.entities.Resultat;<br>import be.labocollard.server.entities.Prestation;<br>import be.labocollard.server.entities.PrestationFacturable;<br>import be.labocollard.server.entities.Utilisateur
;<br><br>rule &quot;asserteResultatAndPrestation&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrestationFacturable ( $resultat : resultat , $prestation : prestation)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;assert ( $resultat );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;assert ($prestation);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br><br>rule &quot;findRelevantResult&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$resultat : Resultat()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval($resultat.getResults().size()&gt;0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;assert($resultat.getResults().iterator().next());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br><br>rule &quot;testPsaId&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$prestation : Prestation(id == &quot;psaId&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$prestationFacturable : PrestationFacturable (prestation==$prestation,
<br>$resultat : resultat)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result : Result (doubleValue &lt; (new Double(12)))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resultat (id == $resultat.getId(), results contains $result )<br>&gt;&gt;&gt; this sentence makes problem ...
<br>&gt;&gt;&gt; and i would like to avoid eval<br>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #eval ($resultat.getId()==id &amp;&amp;<br>$resultat.getResults().contains($result) )<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utilisateur (age &lt; (new Integer(55))) || Utilisateur (sex !=
<br>HumanSexType.MALE)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;retract($prestationFacturable);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br><br>Is there a drools guru to explain my misunderstanding ????<br><br>thanks a lot<br><br>and thanks to drools developpers for those wonderfull tools
<br><br>JLL<br>--<br>View this message in context: <a href="http://www.nabble.com/explanation-on-drl-usage-tf3535518.html#a9868635">http://www.nabble.com/explanation-on-drl-usage-tf3535518.html#a9868635</a><br>Sent from the drools - user mailing list archive at 
<a href="http://Nabble.com">Nabble.com</a>.<br><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;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3124-6000<br>&nbsp;&nbsp;Mobile: +55 11 9218-4151
<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>