In the case below you don't need to iterate manually. You can use the
"contains" LHS element. Take a look at the manual and you will see it. Or you
can insert your List directly and use the "from" LHS element
Using from it might look like:
rule "test"
when
String(this=="10") //<--The time
friends : List() //<--Your friends collection
String(this=="myFriend") from friends
then
System.out.println("HIT");
end
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of can_man(a)gmx.de
Sent: Monday, February 16, 2009 4:40 PM
To: Rules Users List
Subject: Re: [rules-users] foreach in drl file
Thanks for the reply Ingomar.
I am still not quite there.
>, 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"
So the condition is where?
What I would be looking for is a plain text description of the rule, ie.
"find all serial numbers of all Golfer objects that have ..." Or
something like that.
Prose is usually a fairly good starting point for transcribing into
rules/drl.
I will try, hopefully it is a bit clearer this time.
friends = ['Mike', 'Tom', 'Anna'] // this is the collection I want
to itterate over
time = 10
When my 'friend' is one of 'friends' and time is 10 o'clock then ring
my alarm.
Hope this shows where I would like the collection to get into play.
Thank you,
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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users