[rules-users] best practices for lookup tables like interest table?

Greg Barton greg_barton at yahoo.com
Mon Oct 19 13:55:34 EDT 2009


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 <strug at web.de>
To: rules-users at lists.jboss.org
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
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



      




More information about the rules-users mailing list