Hmmm... the only way I can see this is possible (i.e. with the use of accumulate) is to use transient facts:-<br><br><i><b>This can be set-up with a decision table quite easily (and ValuedRegion can be a declarative type that extends Region adding the &quot;value&quot; field)<br>
</b></i><br><span style="font-family:courier new,monospace">rule &quot;setup ValuedRegions - using a decision table&quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    when</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">        $Region( $score : score )</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    then</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">        insertLogical( new ValuedRegion( $score, [a value] ) );</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace">
<br><i><b>Your rule<br></b></i><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
rule &quot;Calculate Value&quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
    when</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        $c : Company()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        $r : Region()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        $val : Double() from accumulate (ValuedRegion($score : score, $value : value ) , sum($score * $value))</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
    then</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
        // Do Something</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
end</span><br style="font-family:courier new,monospace">
<br><div class="gmail_quote">On 10 April 2012 14:51, Davout <span dir="ltr">&lt;<a href="mailto:davout1805@gmail.com">davout1805@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I&#39;m trying to figure out how I can use a Decision Table as a lookup table. I<br>
did come across<br>
<a href="http://drools.46999.n3.nabble.com/Rules-with-Lookup-Tables-td56996.html" target="_blank">http://drools.46999.n3.nabble.com/Rules-with-Lookup-Tables-td56996.html</a><br>
however, it asking about using a database.<br>
<br>
Typical Senario:<br>
Where [value from lookup table] is the value retrieved from the Decision<br>
Table. The reason I&#39;m looking at a Decision Table rather than using a<br>
database is because the number of conditions needs to be changeable by end<br>
users.<br>
<br>
rule &quot;Calculate Value&quot;<br>
    when<br>
        $c : Company()<br>
        $r : Region()<br>
        $val : Double()<br>
            from accumulate (Region($score : score) , sum($score * [value<br>
from lookup table]))<br>
    then<br>
        // Do Something<br>
end<br>
<br>
Thanks.<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Using-Decision-Tables-as-Lookup-Tables-tp3899689p3899689.html" target="_blank">http://drools.46999.n3.nabble.com/Using-Decision-Tables-as-Lookup-Tables-tp3899689p3899689.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</blockquote></div><br>