[rules-users] foreach in drl file

can_man at gmx.de can_man at gmx.de
Mon Feb 16 17:58:03 EST 2009


Hello,


> maybe you can tell us what you are trying to do? Are you talking about  
> the RHS?
> 
> --Ingomar

thank you for your reply. I would like to use a template drl file together with a java class. Both the LHS and RHS should contain variables, where the LHS should itterate over a collection in the "when" part.

So for example, in the golf example, I would like a foreach which itterates through a list in my java class, e.g. "Golfer", and addes the conditions in the collection to my rule with "ANDs".

rule "find solution"
    when
        // cut 

        Golfer( 

        @foreach{item : products} 
        - @{item.serialNumber}
        @end{}

        )

	then
           // do something
end

My problem is that I don't really know how to write the foreach syntax.
Hope this is clear.

Thank you.
Phil

> Am 16.02.2009 um 23:15 schrieb can_man at gmx.de:
> 
> > Hello,
> >
> > I would like to itterate over a list in a drl template file, I  
> > looked at http://mvel.codehaus.org/MVEL+2.0+Orb+Tags
> >
> > @foreach{item : products}
> > - @{item.serialNumber}
> > @end{}
> >
> > but I just can't get the syntax right. Could someone please post an  
> > example drl file with a foreach.
> >
> > Thank you very much.
> > Phil
> > -- 
> > Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
> > für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/? 
> > ac=OM.AD.PD003K11308T4569a
> > _______________________________________________
> > 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

-- 
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a



More information about the rules-users mailing list