<br> Hi there,<br><br> Best to understand your needs before suggesting, but working simply on syntax, if you are using trunk, you can do this:<br><br>rule "findRelevantResult"<br> when<br> $resultat : Resultat( (
results.size() > 0 ) )<br><div style="direction: ltr;"> then<br> end<br><br>rule "testPsaId"<br> when<br> $prestation : Prestation(id == "psaId")<br> $prestationFacturable : PrestationFacturable (prestation==$prestation, $resultat : resultat)
<br> $result : Result ( doubleValue < 12 )<br> Resultat ( this == $resultat , results contains $result )<br> Utilisateur ( ( age < 55 || sex != HumanSexType.MALE) )<br> then
<br> end</div><br> Ok, now I made things confuse right? :) Next step for us to get rid of the double "(" when using only a single predicate.<br> Anyone willing to help document and explain the above?<br>
<br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/4/6, JLL <<a href="mailto:jll@labocollard.be">jll@labocollard.be</a>>:</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'm quiet new in drools (a french speaking so i appologise for my english<br>mistakes) and i'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 == "F" )<br>Person( age == ( new Integer(girlAge.intValue() + 2) ), sex == 'M' )<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 "asserteResultatAndPrestation"<br> when<br> PrestationFacturable ( $resultat : resultat , $prestation : prestation)<br> then<br> assert ( $resultat );<br>
assert ($prestation);<br> end<br><br>rule "findRelevantResult"<br> when<br> $resultat : Resultat()<br> eval($resultat.getResults().size()>0)<br> then
<br> assert($resultat.getResults().iterator().next());<br> end<br><br>rule "testPsaId"<br> when<br> $prestation : Prestation(id == "psaId")<br> $prestationFacturable : PrestationFacturable (prestation==$prestation,
<br>$resultat : resultat)<br> $result : Result (doubleValue < (new Double(12)))<br><br> Resultat (id == $resultat.getId(), results contains $result )<br>>>> this sentence makes problem ...
<br>>>> and i would like to avoid eval<br>>>> #eval ($resultat.getId()==id &&<br>$resultat.getResults().contains($result) )<br><br> Utilisateur (age < (new Integer(55))) || Utilisateur (sex !=
<br>HumanSexType.MALE)<br> then<br> retract($prestationFacturable);<br> 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> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>