[rules-users] For loop inside a modify block problem
Martin A
wmlsub at gmail.com
Tue Jan 10 14:27:20 EST 2012
Strangely, after making the changes, that 'for' loop makes the Drools
engine to come up with the same error (no such identifier).
I commented the loop and it does not throw that error.
Any ideas why this happens?
Thanks
On Tue, Jan 10, 2012 at 9:04 PM, Martin A <wmlsub at gmail.com> wrote:
> Hi, Mauricio,
>
> Thanks for the help.. but what do you mean by ' that loop is not doing
> anything '
>
> Regards,
> Martin
>
>
> On Tue, Jan 10, 2012 at 8:59 PM, Mauricio Salatino <salaboy at gmail.com>wrote:
>
>> yeah.. sort of..
>> you can do
>>
>> $gsc.doSomething($item.id);
>> for (int i = 0; i < $item.quantity; i++) {
>> $gsc.doSomethingElse($item.id);
>> }
>> update($gsc);
>>
>> but by the way.. that loop is not doing anything ..
>>
>>
>> 2012/1/10 Martin A <wmlsub at gmail.com>:
>> > Hello,
>> >
>> > I suppose that means something like:
>> >
>> > modify ($gsc) {
>> > doSomething($item.id);
>> > }
>> >
>> >
>> > for (int i = 0; i < $item.quantity; i++) {
>> > $gsc.doSomethingElse($item.id);
>> > }
>> >
>> > update($gsc);
>> >
>> > Thanks,
>> > Martin
>> >
>> > 2012/1/10 Wolfgang Laun <wolfgang.laun at gmail.com>
>> >>
>> >> No can do, because within a modify block a comma-separated list of
>> >> (setter) method calls of the object between the parentheses must be
>> written.
>> >>
>> >> Note that you can change a fact (without a modify statement) - just
>> follow
>> >> this with an update call.
>> >>
>> >> See the Expert manual for details.
>> >>
>> >> -W
>> >>
>> >>
>> >> 2012/1/10 Martin A <wmlsub at gmail.com>
>> >>>
>> >>> Hello, guys,
>> >>>
>> >>> I have the following snippet of a right side rule:
>> >>>
>> >>>
>> >>> modify ($gsc) {
>> >>> doSomething($item.id);
>> >>>
>> >>> for (int i = 0; i < $item.quantity; i++) {
>> >>> doSomethingElse($item.id);
>> >>> }
>> >>> }
>> >>>
>> >>> which looks like is invalid syntax in some way, but it comes out with
>> >>> strange error report, such as '[Error: no such identifier: $item]'
>> >>>
>> >>> Would you please assist me on how to put that loop inside that modify
>> >>> block?
>> >>>
>> >>> Thank you and regards,
>> >>> Martin
>> >>>
>> >>> _______________________________________________
>> >>> rules-users mailing list
>> >>> rules-users at lists.jboss.org
>> >>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>>
>>
>> --
>> - CTO @ http://www.plugtree.com
>> - MyJourney @ http://salaboy.wordpress.com
>> - Co-Founder @ http://www.jugargentina.org
>> - Co-Founder @ http://www.jbug.com.ar
>>
>> - Salatino "Salaboy" Mauricio -
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120110/b50e3125/attachment.html
More information about the rules-users
mailing list