Jump to content

DecimalFormat


keinname

Recommended Posts

Hello.

I have a field wich I want to round to two decimals.

My Field in the source-XML: <invwert wrt="8.89">8,890</invwert>

In iReport 2.0.5 I created two fields, one as double regarding on wrt="8.89" and one as string regarding on 8,890.

I searched this forum and tried the following:

  1. Text field Expression Class: java.lang.Double
    Pattern: #,##0.00
    Expression (the double value): $F{invwert_wrt}
    Result on Report: 889,00
     
  2. Text field Expression Class: java.lang.String
    Pattern: #,##0.00
    Expression (the stringvalue): $F{invwert}
    Result on Report: 8,890
     
  3. Text field Expression Class: java.lang.String
    Pattern: nothing
    Expression: (new DecimalFormat("#,###,##0.00")).format($F{invwert}.doubleValue()).toString()
    Result on Report: 8,89 -> BUT: on my system ok, on a second system not?? Why?
     
  4. Text field Expression Class: java.lang.String
    Pattern: nothing
    Expression: String.valueOf(new DecimalFormat("#,###,##0.00").getInstance(Locale.GERMAN).format($F{invwert_wrt}))
    Result on Report: 889
     

Did anyone see the problem or can tell me the solution? Thanks for your help...

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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