{"id":2761,"date":"2022-08-30T15:27:33","date_gmt":"2022-08-30T15:27:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/08\/error-calculating-in-jasper-report-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:27:33","modified_gmt":"2022-08-30T15:27:33","slug":"error-calculating-in-jasper-report-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/error-calculating-in-jasper-report-collection-of-common-programming-errors\/","title":{"rendered":"Error calculating in jasper report-Collection of common programming errors"},"content":{"rendered":"<p>I have two fields as a total of a group and I&#8217;m trying to calculate the variance in a third field. this is how I&#8217;m trying to do:<\/p>\n<pre><code> \/\/ Checking divisor is zero\n ($V{BigDecimal.toString()} == \"0\") ?  new BigDecimal(0) :\n(new BigDecimal(\n$V{BidDecimal1}.toString())\n     .subtract (new BigDecimal($V{BigDecimal}.toString()))\n     .divide(new BigDecimal($V{BigDecimal}.toString()), MathContext.DECIMAL128)\n     .multiply( new BigDecimal(100)\n)\n<\/code><\/pre>\n<p>However, I&#8217;m getting a Division undefined error. Sometimes I got a Division by zero error too.<\/p>\n<p>Thank you for any help.<\/p>\n<p id=\"rop\"><small>Originally posted 2014-02-08 16:01:48. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have two fields as a total of a group and I&#8217;m trying to calculate the variance in a third field. this is how I&#8217;m trying to do: \/\/ Checking divisor is zero ($V{BigDecimal.toString()} == &#8220;0&#8221;) ? 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&#8217;m [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2761","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2761"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2761\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}