Error calculating in jasper report-Collection of common programming errors
I have two fields as a total of a group and I’m trying to calculate the variance in a third field. this is how I’m trying to do:
// Checking divisor is zero
($V{BigDecimal.toString()} == "0") ? new BigDecimal(0) :
(new BigDecimal(
$V{BidDecimal1}.toString())
.subtract (new BigDecimal($V{BigDecimal}.toString()))
.divide(new BigDecimal($V{BigDecimal}.toString()), MathContext.DECIMAL128)
.multiply( new BigDecimal(100)
)
However, I’m getting a Division undefined error. Sometimes I got a Division by zero error too.
Thank you for any help.