Number Format in Report not Applying

Hi,

I have created a report using a word (docx) document as the template and I am trying to format the numbers using #,##0,## however the output uses # format instead. How can I fix this I used the value format in the report editor.

Kind regards,
Mohamed

Hi, @mohamed20884!

Your pattern seems incorrect, may be instead of last , should be . (#,##0.##)? Problem may be caused by default locale of your java. Symbol , means grouping separator in pattern string, but in different locales this separator can be different characters. May be in your locale this character is space, then formatted number 12345678 will be like 12 345 678. If it is not the case, could you please provide example of formatted number and version of Cuba platform in your project? Exported sample report will also help.

Regards,
Sergey

Hi Sergey,

I made sure it is using the same as you said as I was using one from available parameters. I have uploaded a copy of the report.
Receipt PDF.zip (92.6 KB)

Thanks

Hi, @mohamed20884!

To format numbers we use standard java.text.DecimalFormat and it should use your default locale. You could try to check what will happen when formatting numbers with DecimalFormat, the result should not differ from the one in the report.
The problem may be in GroupingSeparator and DecimalSeparator characters. You could get default locale using Locale.getDefault() method. Could you check which values getDisplayLanguage(), getDisplayCountry(), getLanguage() and getCountry() methods of default Locale instance will return?

Locale defaultLocale = Locale.getDefault();

defaultLocale.getDisplayLanguage();
defaultLocale.getDisplayCountry();
defaultLocale.getLanguage();
defaultLocale.getCountry();

Then I can check which characters DecimalFormat will use and perform some formatting tests.

Regards,
Sergey

Hi @s.fedorov,

I have used the functions as requested here is the results

defaultLocale.getDisplayLanguage(); English
defaultLocale.getDisplayCountry(); United States
defaultLocale.getLanguage(); EN
defaultLocale.getCountry(); US

please advise.

Thanks,
Mohamed

Hi, @mohamed20884!

I’ve performed some tests with your locale parameters and copy of your report, but problem is not reproduced. Numbers formatted as expected.

Could you please provide sample project with repoduced problem?

Regards,
Sergey