This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jasper iReport is giving the wrong sum.
 
Similar Threads
Query gives the wrong data
The BarTenders Kids
reference ... is ambiguous. How to handle it?
Trouble running simple sum-up program.
what's wrong with this code..coz when I compile it I get some starnge results