Not that I can see any problem. Disregard the Eclipse error, expand the template as documented, and then we'll see what we'll see...<br>-W<br><br><div class="gmail_quote">On 14 April 2011 15:36, FrankVhh <span dir="ltr"><<a href="mailto:frank.vanhoenshoven@agserv.eu">frank.vanhoenshoven@agserv.eu</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;">Hi W.,<br>
<br>
Thanks for the fast reply.<br>
<br>
Meanwhile, I have been trying to play with the templates. Unfortunately, I<br>
run into a nullpointerexception in the problems view of Eclipse. At first, I<br>
hoped it was the same error as in<br>
<a href="http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html" target="_blank">http://lists.jboss.org/pipermail/rules-users/2010-November/017229.html</a> but<br>
that does not seem to be the case.<br>
<br>
Underneath, you can find my drl file. This is the only artifact that I am<br>
having right now. There is no Java code yet, apart from the Price object.<br>
This shouldn't be necessary to fix the problem either.<br>
<br>
I tried to comment out some pieces of code to narrow down on the problem.<br>
The nullpointerexception persists even if you comment everything from<br>
"package" to the bottom of the file. This should indicate the problem has to<br>
be in the template header, but I do not have a clue.<br>
<br>
Could anyone help with this?<br>
<br>
Thanks in advance.<br>
<br>
======================================================================<br>
<br>
template header<br>
minimumValue<br>
maximumValue<br>
precision<br>
startlevel<br>
endlevel<br>
roundingvalue<br>
<br>
package rounding<br>
<br>
import rounding.Price;<br>
<br>
template "Determine evaluated decimals"<br>
rule "Determine evaluated decimals @{row.rowNumber}"<br>
salience 25<br>
lock-on-active true<br>
when<br>
$price: Price(integerpart >= @{minimumValue} && integerpart <<br>
@{maximumValue} && evaluateddecimals == 9999999)<br>
then<br>
$price.setRoundedPrecision(@{precision});<br>
$price.calculateNumberOfRoundedDecimals();<br>
$price.calculateEvaluatedDecimals();<br>
$price.calculateBasenumber();<br>
update($price);<br>
end<br>
end template<br>
<br>
template "Determine rounding value"<br>
rule "Determine rounding value @{row.rowNumber}"<br>
salience 0<br>
no-loop true<br>
when<br>
$price: Price(integerpart >= @{minimumValue} && integerpart <<br>
@{maximumValue} && evaluateddecimals >= @{startlevel} && evaluateddecimals <<br>
@{endlevel})<br>
then<br>
$price.setRoundedPrice($price.getBasenumber() + @{roundingvalue});<br>
System.out.println($price.getPrice() + " => " + (double)<br>
$price.getRoundedPrice() / Math.pow(10,$price.getNumberofroundeddecimals())<br>
);<br>
end<br>
end template<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.html" target="_blank">http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p2820343.html</a><br>
</font><div><div></div><div class="h5">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>
</div></div></blockquote></div><br>