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