File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Jasper iReport is giving the wrong sum. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Jasper iReport is giving the wrong sum." Watch "Jasper iReport is giving the wrong sum." New topic

Jasper iReport is giving the wrong sum.

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 634
I don't know why when I sum up the NetSales to a variable, set it as a type of bigdecimal, the field will give it a wrong sum
Anyone shed some lights on this, it would be greatly appreciated!

[Thumbnail for wrong sum 1.png]

[Thumbnail for wrong sum 2.png]

Supun Lakshan Dissanayake
Ranch Hand

Joined: Oct 26, 2012
Posts: 135

probably you don't get the sum correctly.

Here is the way.

1. create a variable named total in Variables section in report inspector(in iReport designer).
2. select it and get it's properties.
3. select java.lang.Double as variable class
4. select sum as variable calculation
5. select field you want to get sum as Variable expression
6. drag and drop this variable to your report.

Hope this works.

Are you better than me? Then please show me my mistakes..
I agree. Here's the link:
subject: Jasper iReport is giving the wrong sum.
It's not a secret anymore!