[rules-users] Working with Maps

Gerald Cantor geraldmcantor at yahoo.com
Wed Apr 9 17:44:58 EDT 2008


I have a Map in working memory. The Map has Strings as keys and Integers as
values. It has 7 keys (REG301, REG302, ... REG307). I'm looking for a way to
incorporate the following into the LHS of a rule:

For keys 301, 302, 303, compute the total of the Integer values (total 1)
For keys 301, 302, 303, compute the number of keys that have greater than 0
values (total 2)
Divide total 1 by total 2 (if total 2 > 0) and check against a range

For keys 304, 305, 306, 307, compute the total of the Integer values (total
3)
For keys 304, 305, 306, 307, compute the number of keys that have greater
than 0 values (total 4)
Divide total 3 by total 4 (if total 4 > 0) and check against a range

I have not seen a way to collect / sum over select Map elements.

Any insight as to how I would compute the above totals using collect / sum
would be very much appreciated.

Thanks in advance,
Gerald
-- 
View this message in context: http://www.nabble.com/Working-with-Maps-tp16597566p16597566.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list