Sorry, the fields are not public, but their getters are. But still not working when I use the getters.
hi Michael,All of the fields are public, however they are properties of a super class of Item. I tried with getters, doesn't work either way.Still getting: 'no such identifier : $item'. When I remove the for loop, it goes ok, so I think it messes up things.Best regards,Martin2012/1/11 Michael Anstis <michael.anstis@gmail.com>
RHS is not DRL syntax but Java or MVEL depending on your dialect.
If "id" is not public you should use it's getter. The same goes for "quantity".$gsc.doSomething($item.getId() );
when
$item : Item(param1 != 0, param2 == 0, !(this instanceof SpecialItem))
$gsc : SomeBusinessLogic
then
for (int i = 0; i < $item.getQuantity(); i++) {
$gsc.doSomethingElse($item.getId() );
}
update($gsc);
end2012/1/11 Martin A <wmlsub@gmail.com>
Hi, Davide,Here is how my rule looks like :when$item : Item(param1 != 0, param2 == 0, !(this instanceof SpecialItem))$gsc : SomeBusinessLogicthen$gsc.doSomething($item.id);endThe above snippet throws an error @ i < $item.quantity, and says 'no such identifier $item'...I can't figure out what might be causing this.ThanksOn 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