Hmmm... the only way I can see this is possible (i.e. with the use of
accumulate) is to use transient facts:-
*This can be set-up with a decision table quite easily (and ValuedRegion
can be a declarative type that extends Region adding the "value" field)
*
rule "setup ValuedRegions - using a decision table"
when
$Region( $score : score )
then
insertLogical( new ValuedRegion( $score, [a value] ) );
end
*Your rule
*
rule "Calculate Value"
when
$c : Company()
$r : Region()
$val : Double() from accumulate (ValuedRegion($score : score, $value
: value ) , sum($score * $value))
then
// Do Something
end
On 10 April 2012 14:51, Davout <davout1805(a)gmail.com> wrote:
Hello,
I'm trying to figure out how I can use a Decision Table as a lookup table.
I
did come across
http://drools.46999.n3.nabble.com/Rules-with-Lookup-Tables-td56996.html
however, it asking about using a database.
Typical Senario:
Where [value from lookup table] is the value retrieved from the Decision
Table. The reason I'm looking at a Decision Table rather than using a
database is because the number of conditions needs to be changeable by end
users.
rule "Calculate Value"
when
$c : Company()
$r : Region()
$val : Double()
from accumulate (Region($score : score) , sum($score * [value
from lookup table]))
then
// Do Something
end
Thanks.
--
View this message in context:
http://drools.46999.n3.nabble.com/Using-Decision-Tables-as-Lookup-Tables-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users