Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassCastException in Jreport formula

 
vivien siu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
vivien siu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic