Jump to content
JasperReports Library 7.0 is now available ×

Dividing BigDecimal field by String field


jbessmer

Recommended Posts

Hi Everyone,

I'm a newbie and attempting to divide a BigDecimal field (bdfield) by a String field (strfield) in Jaspersoft Studio.

I've tried about 2 dozen approaches based on what I've read on these and other forums, but haven't been successful. Does anyone have a preferred approach?

Edit:  Here are some approaches I've tried:

$F{bdfield}.divide(Integer.parseInt($F{strfield})).setScale(2, RoundingMode.CEILING)

$F{bdfield}.divide(new Integer($F{strfield})).setScale(2, RoundingMode.CEILING)

$F{bdfield}.setScale(2, RoundingMode.CEILING) / new Integer($F{strfield})

$F{bdfield}.doubleValue() / new Double($F{strfield})

$F{bdfield}.doubleValue() / new Integer($F{strfield})

$F{bdfield}.doubleValue() / Double.parseDouble($F{strfield})

 

 

Here is the error on the last one:

Double.parseDouble cannot be resolved to a type value = ((java.math.BigDecimal)field_bdfield.getValue()).doubleValue() / new Double.parseDouble(((java.lang.String)field_strfield.getValue()));

 

Thanks for taking a look,

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...