[rules-users] having trouble using accumulate to create a list of non null objects

burmanator alexburman at gmail.com
Wed May 1 09:18:18 EDT 2013


I have 2 objects, Foo and Bar. Foo can store an instance of Bar. I am trying
to create a list of all the Bar objects that correspond to all the Foo
objects with a given name.

the line in my rule I am using is: 

Foo($name : Name)

$list : List() from accumulate( Foo( Name == $name, $b : Bar != null),
collectList($b))

Yet when I print out the list, it includes null elements. But if I instead
make the rule: 

$list : List() from accumulate( Foo( Name == $name, $b : Bar != null),
collectList($b!=null))

I get false for all the null Bar objects.

Am I missing something?



--
View this message in context: http://drools.46999.n3.nabble.com/having-trouble-using-accumulate-to-create-a-list-of-non-null-objects-tp4023606.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list