It is your problem, which I've reproduced. And "being broken" sure means "a bug".<br>-W<br><br><div class="gmail_quote">2012/1/12 Martin A <span dir="ltr"><<a href="mailto:wmlsub@gmail.com">wmlsub@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, Wolfgang,<div><br></div><div>Looks like the same problem appears on my side... So is it a bug, or misuse of the MVEL syntax?</div>
<div><br></div><div>Best regards,</div><div>Martin</div><div class="HOEnZb"><div class="h5"><div><br><div class="gmail_quote">
On Thu, Jan 12, 2012 at 4:11 PM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Using 5.3.0 Final.<br>
<br>
The reported compilation problem ("no such identifier: $item") occurs<br>
with dialect MVEL, which appears to be broken w.r.t. RHS code containing<br>
a "for" statement. Note: the error is not flagged for the preceding occurrrence<br>
of $item, in $<a href="http://item.id" target="_blank">item.id</a>.<br>
<br>
Different kind of errorscan occur, depending on how the "for"<br>
statement is written,<br>
for example:<br>
int h = 10; for( int i = 0; i < h; i++) { ... } ## Error: no such<br>
identifier: h<br>
<br>
Avoid dialect MVEL - using Java and getters works fine.<br>
<span><font color="#888888"><br>
-W<br>
</font></span><div><div><br>
<br>
On 11/01/2012, Martin A <<a href="mailto:wmlsub@gmail.com" target="_blank">wmlsub@gmail.com</a>> wrote:<br>
> Hi, Davide,<br>
><br>
> Here is how my rule looks like :<br>
><br>
> when<br>
> $item : Item(param1 != 0, param2 == 0, !(this instanceof SpecialItem))<br>
> $gsc : SomeBusinessLogic<br>
> then<br>
> $gsc.doSomething($<a href="http://item.id" target="_blank">item.id</a>);<br>
> for (int i = 0; i < $item.quantity; i++) {<br>
> $gsc.doSomethingElse($<a href="http://item.id" target="_blank">item.id</a>);<br>
> }<br>
> update($gsc);<br>
> end<br>
><br>
> The above snippet throws an error @ i < $item.quantity, and says 'no such<br>
> identifier $item'...<br>
> I can't figure out what might be causing this.<br>
><br>
> Thanks<br>
><br>
> On Tue, Jan 10, 2012 at 10:08 PM, Davide Sottara <<a href="mailto:dsotty@gmail.com" target="_blank">dsotty@gmail.com</a>> wrote:<br>
><br>
>> Did you remember to bind $item to some expression in the LHS ? Maybe you<br>
>> just<br>
>> called that "item" without the $ :)<br>
>> Davide<br>
>><br>
>> (the original "modify" syntax is still wrong anyway)<br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://drools.46999.n3.nabble.com/rules-users-For-loop-inside-a-modify-block-problem-tp3648460p3648718.html" target="_blank">http://drools.46999.n3.nabble.com/rules-users-For-loop-inside-a-modify-block-problem-tp3648460p3648718.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" target="_blank">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>
>><br>
><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div><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>
<br></blockquote></div><br>