Perhaps using a lower and upper bound for days and amount would provide for easier matching.
declare RateOfInterest daysLower: int daysUpper: int amountLower: int amountUpper:int value : double end rule setROI when Account( $a <- amount, $f <- daysFixed ) RateOfInterest( daysLower <= ?f, daysUpper >= $f , amountLower <= $a, amountUpper >= $a, $v <- value ) then ... end Setup as indicated by Greg. -W On Mon, Oct 19, 2009 at 7:55 PM, Greg Barton <[email protected]> wrote: > Add each entry in the table as a working memory object. Insert them in a > rule that fires immediately at startup. > > declare LookupEntry > days : int > amount : int > value : double > end > > rule "Init Lookup" > when > then > LookupEntry entry = new LookupEntry(); > entry.setDays(30); > entry.set(Amount(5000); > entry.setValue(2.7); > > ...etc for all entries... > > end > > > > ----- Original Message ---- > From: strug <[email protected]> > To: [email protected] > Sent: Mon, October 19, 2009 12:39:11 PM > Subject: [rules-users] best practices for lookup tables like interest > table? > > > hi, > > i'm quiet new to writing rules and asking myself - ah you - what is the > best > way to implement a lookup table? > > i want to have the following table reachable from within my rules: > > | 30 days | 60 days | 90 days > > 5000 € | 2.7 % | 2.8 % | 2.9 % > > 10000 € | 2.85 % | 2.9 % | 2.95 % > > 20000 € | 2.9 % | 2.95 % | 3.0 % > .. > > is it best to write a function which works internally on a two dimensional > array? > > i want to have the numbers/tables be part of the drl files, in order to be > able to dynamically reload them, so a java helper class is not aimed. > > thanks for any feedback and experience, leif > -- > View this message in context: > http://www.nabble.com/best-practices-for-lookup-tables-like-interest-table--tp25962448p25962448.html > Sent from the drools - user mailing list archive at Nabble.com. > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
