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