You could do public final static MAX_AMOUNT in some class foo.Bar and then, in DRL:<br> import function foo.Bar.*;<br>and use MAX_AMOUNT as usual.<br><br>-W<br><br><div class="gmail_quote">On 8 October 2010 12:52, Evert Penninckx <span dir="ltr"><<a href="mailto:evert.penninckx@gmail.com">evert.penninckx@gmail.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;"><br>
Hi<br>
<br>
I've got the following rule:<br>
<br>
when<br>
$sale : Sale( amount > 300 )<br>
then<br>
modify($sale) { amount = 300; }<br>
end<br>
<br>
First problem: I don't like putting the constant value "300" two times in my<br>
rule.<br>
<br>
Second problem: amount is a BigDecimal. I read that mvel2 supports<br>
BigDecimal literals like 300.00B, but drools won't compile this.<br>
<br>
An ideal solution would look like something like this:<br>
<br>
when<br>
$maxAmount : 300.00B<br>
$sale : Sale( amount > $maxAmount )<br>
then<br>
modify($sale) { amount = $maxAmount; }<br>
end<br>
<br>
<br>
1. Is it possible to attribute values to a variable?<br>
<br>
2. If not, is it possible to use mvel's BigDecimal support? Because amount<br>
> 300.00B says a lot more than eval(amount.compareTo(new<br>
BigDecimal("300.00")) > 0).<br>
<br>
<br>
<br>
Evert<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Constants-and-BigDecimals-tp1664852p1664852.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Constants-and-BigDecimals-tp1664852p1664852.html</a><br>
Sent from the Drools - User 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>
</font></blockquote></div><br>