Jump to content
Changes to the Jaspersoft community edition download ×

rounding mode

2004 IR Help

Recommended Posts

By: ogerep - ogerep

rounding mode

2005-11-04 07:24


i noticed that the pattern used in textfield (e.g ###0.00) has a ROUND_HALF_EVEN rounding mode. But if i've to print totals of an invoice report i've to use a matematical rounding mode like ROUND_HALF_UP . To obtain this i put in textfield expression " new BigDecimal(myVariable).setScale(myScala,BigDecimal,ROUND_HALF_UP)".

Does a simplier method exist?

is possibile to change the rounding mode used by pattern ?






By: Kolesnikov Alexey - kolesnikov

RE: rounding mode

2005-11-14 12:52



I'm not sure about pattern rounding mode but I have some trick which helps me make nice formatting in whole report.

I created special class with many format functions like toJPY, toRUB, etc. I put this class into report parameters map. Then I use it like this "((MyClass)$P{fmt}).toJPY($F{myField})"

The only problem is how to let JasperReport know about class type. I use simple casting, but I guess there is more suitable way.


Hope this helps.

Link to comment
Share on other sites

  • Replies 0
  • 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...