Jump to content
JasperReports Library 7.0 is now available ×

how do do conditional variables


tonyg

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...