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 &lt;- amount, $f &lt;- daysFixed )<br>   RateOfInterest( daysLower &lt;= ?f, daysUpper &gt;= $f , amountLower &lt;= $a, amountUpper &gt;= $a, $v &lt;- 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">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</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 &quot;Init Lookup&quot;<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 &lt;<a href="mailto:strug@web.de">strug@web.de</a>&gt;<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&#39;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>
&gt; 5000 €   |  2.7 %    | 2.8 %     | 2.9 %<br>
&gt; 10000 € | 2.85 %   | 2.9 %     | 2.95 %<br>
&gt; 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>