Changing number formats

0

Hi,

I'm doing a report with some lists of numbers and they are showing with the format: 1,000.00

 & I want to show the numbers like 1.000,00

I tried to use as custom format in the pattern this:

##.#00,00

but it doesnt work, the report is not compiling after doing only this change.

 

Anyone can help me?

sgarciaf's picture
Joined: May 10 2010 - 1:29am
Last seen: 6 years 12 months ago

8 Answers:

0

uhm...

the char:
represents a grouping separator

.  represents a decimal separator...

so you can't exchange their position...

you must set a pattern like "##,#00.00" an the change the LOCALE according to the format you expect:

change the LOCALE from

- build-->setReportLocale-->choose one (from ireport 2 and similar)
- Tool-->Option-->Compilation and Execution-->Execution Option -->Select Report Locale (for ireprt 3.7 and siimilar)

 

(i prefer OLD VERSION of IReport...! )

 

 

 

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening: MUSICA NUDA - Sacrifice

 

slow's picture
911
Joined: Feb 17 2010 - 6:57am
Last seen: 9 years 11 months ago
0
Thanks Slow.

This solves the problem if I compile with iReports, but I'm compiling the report with a java application in a server...
I have the same problem with dates and the numbers in the charts...
I tried to put in the expression something like:
NumberFormat.getNumberInstance(Locale.GERMAN).format($V{numAyuMeasure})
But this only solves the numbers format and not the numbers in the chart and dates.

There's a way to set the Report Locale options in Java?

Well, at least I know what's the problem now...
sgarciaf's picture
Joined: May 10 2010 - 1:29am
Last seen: 6 years 12 months ago
3

sorry, I thought the problem was the interface of iReport...

try putting this in the data map you pass when you compile and run the report:

Locale locale = new Locale("en", "US")  <--- change this.
metadata
.put(JRParameter.REPORT_LOCALE, locale);

 

remember KARMA points :)

 

 

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening: Placebo - Where is my mind


 

 

 

slow's picture
911
Joined: Feb 17 2010 - 6:57am
Last seen: 9 years 11 months ago
0
Thanks slow,

I set the parameter:
parameters.put("REPORT_LOCALE", new java.util.Locale("es", "ES")); //SPANISH

& now the numbers in the lists and in the crosstabs are showing ok, but the numbers in the charts (in the axis) are stil showing like 1,000.00).

I passed the REPORT_LOCALE to all my subreports (its a paremeter) and the same for all my queries (& in the charts I set the parameter), but it didnt work in charts.

Thanks.
sgarciaf's picture
Joined: May 10 2010 - 1:29am
Last seen: 6 years 12 months ago
0

unfortunately I don't use charts created using iReport so I can't help you in this... but i think there is a way to pass the locale you set to JFreeChart (engine that create the chart)...

read this:

http://stackoverflow.com/questions/1588196/passing-locale-details-via-jasper-reports-to-jfreechart

or similar.

if you find a solution, post it :)

 

 

 

 

slow's picture
911
Joined: Feb 17 2010 - 6:57am
Last seen: 9 years 11 months ago
-1
It worked ^^


I copy-pasted the code in your link and worked :D

Thanks & karma++;
sgarciaf's picture
Joined: May 10 2010 - 1:29am
Last seen: 6 years 12 months ago
0

thank you for the reply...

help someone,even if unknown, has a special charm...

 

listening: Nine Inch Nails - HURT.

 

 

slow's picture
911
Joined: Feb 17 2010 - 6:57am
Last seen: 9 years 11 months ago
0

In desperate need for help. I prepared a report via ireport and changed the number format, it works perfectly when it's an english locale but it does nothing when i change the local to french!! 

How can I fix this??

smilingpanda's picture
Joined: Jan 26 2016 - 12:16am
Last seen: 3 years 11 months ago
Feedback
randomness