2004 IR Help Posted August 24, 2006 Share Posted August 24, 2006 By: ogerep - ogerep rounding mode 2005-11-04 07:24 Hi 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 ? Tks By: Kolesnikov Alexey - kolesnikov RE: rounding mode 2005-11-14 12:52 Hi 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now