File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes ClassCastException in Jreport formula Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ClassCastException in Jreport formula" Watch "ClassCastException in Jreport formula" New topic
Author

ClassCastException in Jreport formula

vivien siu
Ranch Hand

Joined: Nov 10, 2005
Posts: 143
Hello I need help from JReport users. I am trying to write a formula in Jreport that will calculate the difference of 2 Double fields from database and return it as a Double value as well.

currently I'm using the following formula, the syntax check is ok but it gives me an exception during runtime:
return Abs(@field1)-Abs(@field2)


I checked the datatype of the field and noticed it is BigInt. So how do I set the datatype of the formula?


I'm not available, my BF's name is WORK.
vivien siu
Ranch Hand

Joined: Nov 10, 2005
Posts: 143
It's ok, I just solved it.

This is how I do it:
currency bal = 0.00;
bal = Abs(@field1) - Abs(@field2);
return bal;


Then my datatype will be set as Double by the system and I just need to set the <formula> under <report inspector> that's it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException in Jreport formula