Comma or Dot as decimal mark



i'm building a report with iReport but i run into a problem.

An XML file gives me a percentage of availability of a system (93,0%) but iReport thinks its 9,300.0%!

i have looked all over the software including changing the locale option to Netherlands, but i can't find the option to use the , instead of the . as decimal mark.

Can someone help me please?


sjoerd.jump's picture
Joined: Oct 29 2012 - 2:39pm
Last seen: 2 years 8 months ago
Does the XML actually have the string "93,0%"? If so, how are you converting it to a number? It seems like you are dropping the percent, reading it as a number and then converting it to a percent. So it sees 93,0 as a number and then converts 93 to a percent, yeilding 9300% - reading the original comma correctly and displaying the result with a dot. So there are two problems you are trying to solve? 1) that it should be 93% not 9300%, and 2) that it should display as 93,0% not 93.0%
mgeise - 4 years 10 months ago
Hi, thanks for you extensive repley. My xml file tells me: 0.93 No matter what type I give to the field (java.math.Bigdecimal, java.lang.string etc.), it will display 1 as 100.00% and 0.93 as 9.300,00% when using the suppley patern (#,##0.00 %) if i change this to #.##0,00 % the restult is: Error filling print... Malformed pattern "#.##0,0 %" i also have changed the Report Locale to my country. Still no luck ;-) What am i doing wrong? I know i have missed something...
sjoerd.jump - 4 years 10 months ago

1 Answer:


Here are the findings I have when I try this and my suggestions for solving your issue:

  • When I set up a report (I am using a DB, not XML, but it should be the same) that has a field with values: 1.0, 0.93, and 12.34 the field type ends up being java.math.BigDecimal.
  • Now I add that field to the report layout and give it the following pattern: #,##0.00 % (The patterns need to be standard Java patterns, which is why you recieved the Malformed pattern exception)
  • I managed the locale by going into iReport>Preferences and the locale is under the iReport "Compilation and execution" settings.  I get the following display of the values based on the following locales:
    • English (United States) gives 100.00 %, 93.00 %, and 1,234.00 %
    • Dutch (Netherlands) gives 100,00 %, 93,00%, and 1.234,00%

My suggestion is the following:

  • Confirm that you are actually setting the REPORT_LOCALE correctly.  You can add the parameter to your report...for Dutch (Netherlands), I see "nl_NL" and for English (United States), I see "en_US"
  • If you are getting numbers that are 100 times what you expect (I am not clear if this is an issue for you), you can create a variable that is the result of the field divided by 100 and use that in your display.

I hope this helps


mgeise's picture
Joined: Mar 5 2007 - 6:18am
Last seen: 6 days 15 hours ago