This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC 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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Jasper iReport is giving the wrong sum." Watch "Jasper iReport is giving the wrong sum." New topic
Author

Jasper iReport is giving the wrong sum.

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 590
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: 132

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: http://aspose.com/file-tools
 
subject: Jasper iReport is giving the wrong sum.