[rules-users] Does Drools Fusion support "Group By" clause ?
Gabor Szokoli
szocske at gmail.com
Mon Jan 3 07:00:49 EST 2011
Hi,
2011/1/3 Kiran Ananthpur Bacche (kbacche) <kbacche at cisco.com>:
> I want the rule to fire successfully only when the TotalSalesAmount for
> _any_ given type exceeds 100.
I've never used "accumulate" myself, so I looked it up in the manual,
and there's an example that's exactly what you want :-)
(just substitute $order with your $type)
rule "Apply 10% discount to orders over US$ 100,00"
when
$order : Order()
$total : Number( doubleValue > 100 )
from accumulate( OrderItem( order == $order, $value : value ),
sum( $value ) )
then
# apply discount to $order
end
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e4893
Gabor
More information about the rules-users
mailing list