"from" iterates your list automatically. So the appropriate syntax
for your rule would be:
$assessment : Assessment()
$p : Person()
exists (Address( state == "NC") from $p.addresses)
[]s
Edson
2010/10/8 Evert Penninckx <evert.penninckx(a)gmail.com>:
The drools user guide contains this example:
when
$assessment : Assessment()
$p : Person()
$addresses : List() from $p.addresses
exists (Address( state == "NC") from $addresses)
then
modify ($assessment) {} #Modify assessment in a modify block
end
I derive from this that $addresses is a list. But when I add a
System.out.println($addresses.getClass().getName()) I get "Address" as
result
Also, when I want to use $addresses as a list in the consequence (eg.
.size() ), I get java.lang.IllegalArgumentException: object is not an
instance of declaring class.
Is this expected behaviour?
Evert
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/List-from-collection-...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com