You cannot create variables on the Left Hand Side; there you can only bind (!)<br>variable names (!) to matched facts or their attributes.<br>-W <br><br><div class="gmail_quote">On 9 November 2011 15:14, elsdestickere <span dir="ltr">&lt;<a href="mailto:elsdestickere@yahoo.com">elsdestickere@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
I&#39;m confused about when en where to use Java or MVEL in a rule.<br>
In the example below I want to replace  &quot;<br>
openRes.getMasterExemplaar().getBruikbareExemplaren()&quot; with a variable.<br>
RHD: works with JAva expression:<br>
        List&lt;Exemplaar&gt; bruikEx =<br>
openRes.getMasterExemplaar().getBruikbareExemplaren();<br>
but I prefer to create the variable in the LHS, but Java doesn&#39;t work here.<br>
Should this be a MVEL expression or should JAVA allways be possible?<br>
<br>
rule &quot;GarandeerReservaties&quot;<br>
    when<br>
        garRes : GarandeerReservatieTaak();<br>
        openRes : Reservatie() from<br>
repFact.getReservatieRepository().findVandaagOpenstaandeReservaties();<br>
     List&lt;Exemplaar&gt; bruikEx<br>
=openRes.getMasterExemplaar().getBruikbareExemplaren();<br>
       eval(Reservatie.getVandaagOpenstaandeReservaties().size() &gt; 0 &amp;&amp;<br>
openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0)<br>
    then<br>
        //List&lt;Exemplaar&gt; bruikEx =<br>
openRes.getMasterExemplaar().getBruikbareExemplaren();<br>
        bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD);<br>
        openRes.setStatus(ReservatieStatus.GEGARANDEERD);<br>
        System.out.println( &quot;Drools &quot;+drools.getRule().getName()+&quot;: ocr:<br>
&quot;+openRes.getAantalVandaagOpenstaandeConcurReservaties() + &quot; bruikex: &quot;<br>
+bruikEx.size() );<br>
end<br>
(written in Dutch, but I think it will be ok to understand)<br>
br,<br>
Els<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html" target="_blank">http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>