[jboss-user] [jBPM] - Drools accumulate function
stellina_rosa
do-not-reply at jboss.com
Mon Jun 20 08:58:09 EDT 2011
stellina_rosa [http://community.jboss.org/people/stellina_rosa] created the discussion
"Drools accumulate function"
To view the discussion, visit: http://community.jboss.org/message/611010#611010
--------------------------------------------------------------
Hi!
I'm trying to use the accumulate function in my rules, but I haven't the expected result. this is my rule:
rule "Total days"
when
$mo: MyObject()
$total : Number() from accumulate(Item(item=="days", $val:value) from $mo.items, sum( $val ) )
then
System.out.println($total);
end
Suppose that tha values of MyObject(id, arrayList<Item> items) are:
MyObject(id=1, items({price,10},{days,2});
MyObject(id=2, items({price,15},{days,5});
MyObject(id=3, items({price,20},{days,7});
the result should be 2+5+7 = 14 but instead it print me 3 value:
2
5
7
.... where I wrong? I want the sum of the days...!
please help me..!
thank you!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/611010#611010]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110620/b7f2164b/attachment.html
More information about the jboss-user
mailing list