tonyg Posted April 3, 2007 Share Posted April 3, 2007 Hi, I am calculating margin to a variable.(below) this works most times, but every so often, i get a divide by zero error. Is there a way to put an if-then in to check for 0 ?? how? thanks <variable name="Cat_Margin" class="java.math.BigDecimal" resetType="Group" resetGroup="SHORT_NAME" calculation="Nothing"> <variableExpression><![CDATA[($V{Cat_Price_Total}.subtract($V{Cat_UPC_Total})).divide($V{Cat_Price_Total},new MathContext(100))]]></variableExpression> </variable> Link to comment Share on other sites More sharing options...
raulinon Posted April 3, 2007 Share Posted April 3, 2007 Hi Tonyg, What language are u using to generate the jasper report? (php asp delphi ???) Link to comment Share on other sites More sharing options...
tonyg Posted April 3, 2007 Author Share Posted April 3, 2007 Hi, Thanks for the reply. i am not sure how to answer your question, I use IReports to create the report, is that what you were asking? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now