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? Thanks!
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