You cannot create variables on the Left Hand Side; there you can only bind (!) variable names (!) to matched facts or their attributes. -W
On 9 November 2011 15:14, elsdestickere <[email protected]> wrote: > Hi, > > I'm confused about when en where to use Java or MVEL in a rule. > In the example below I want to replace " > openRes.getMasterExemplaar().getBruikbareExemplaren()" with a variable. > RHD: works with JAva expression: > List<Exemplaar> bruikEx = > openRes.getMasterExemplaar().getBruikbareExemplaren(); > but I prefer to create the variable in the LHS, but Java doesn't work here. > Should this be a MVEL expression or should JAVA allways be possible? > > rule "GarandeerReservaties" > when > garRes : GarandeerReservatieTaak(); > openRes : Reservatie() from > repFact.getReservatieRepository().findVandaagOpenstaandeReservaties(); > List<Exemplaar> bruikEx > =openRes.getMasterExemplaar().getBruikbareExemplaren(); > eval(Reservatie.getVandaagOpenstaandeReservaties().size() > 0 && > openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0) > then > //List<Exemplaar> bruikEx = > openRes.getMasterExemplaar().getBruikbareExemplaren(); > bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD); > openRes.setStatus(ReservatieStatus.GEGARANDEERD); > System.out.println( "Drools "+drools.getRule().getName()+": ocr: > "+openRes.getAantalVandaagOpenstaandeConcurReservaties() + " bruikex: " > +bruikEx.size() ); > end > (written in Dutch, but I think it will be ok to understand) > br, > Els > > -- > View this message in context: > http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
