Jump to content
We've recently updated our Privacy Statement, available here ×

BigDecimal Division


vk01

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

When using BigDecimals you need to use the mathematical operators defined in the BigDecimal class. So if you need to divide two BigDecimals create an expression of type BigDecimal and use "bigDecimalOne.divide(bigDecimalTwo, BigDecimal.ROUND_HALF_UP)", which gives you the result of a your variable bigDecimalOne divided by the variable BigDecimalTwo.

 

-Barry

Link to comment
Share on other sites

hi mster

sir i use oracle with ireport

but when i use variable for group total

this is my table field

$F{UNICON} i check the type that give me BigDecimal i change with integer

 

and that variable i use $V{mfatt} type is integer

but when i compile that give me error

 

it.businesslogic.ireport.gui.logpane.ProblemItem@f0f875

 

Cannot cast from BigDecimal to Integer Line

 

48, Column 23 /jasperReport/variable

 

[1]/variableExpression[1]

 

 

please give me idea how i get field fotal

and how i change BigDecimal with integer and where i write code

 

thank's

 

aamir

Link to comment
Share on other sites

  • 2 weeks later...

You can get the value of a BigDecimal as an integer by calling intValue() on it, and then create an Integer from that.

 

Be careful though - if iReport thinks the returned value is a BigDecimal, that probably means that the field is declared in the database to be large enough to overflow an integer.

 

-Barry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...