You could do public final static MAX_AMOUNT in some class foo.Bar and then, in DRL:
   import function foo.Bar.*;
and use MAX_AMOUNT as usual.

-W

On 8 October 2010 12:52, Evert Penninckx <evert.penninckx@gmail.com> wrote:

Hi

I've got the following rule:

when
 $sale : Sale( amount > 300 )
then
 modify($sale) { amount = 300; }
end

First problem: I don't like putting the constant value "300" two times in my
rule.

Second problem: amount is a BigDecimal. I read that mvel2 supports
BigDecimal literals like 300.00B, but drools won't compile this.

An ideal solution would look like something like this:

when
 $maxAmount : 300.00B
 $sale : Sale( amount > $maxAmount )
then
 modify($sale) { amount = $maxAmount; }
end


1. Is it possible to attribute values to a variable?

2. If not, is it possible to use mvel's BigDecimal support?  Because amount
> 300.00B says a lot more than eval(amount.compareTo(new
BigDecimal("300.00")) > 0).



Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Constants-and-BigDecimals-tp1664852p1664852.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users