Skip to Content
0
Former Member
Jun 11, 2014 at 07:10 AM

How to use decimal/thousand separators depending on locale settings?

661 Views

Hi,

I have a problem with formatting number fields in Crystal Reports 2011. When I have a default formatting (System Default Number Format), everything is OK, i.e. I get the result 1.23 or 1,23 depending on the locale I run the report (decimal separator changes accordingly to locale settings). The problem occurs when I need to change for example number of decimals - then the decimal separator is "hardcoded" to , (coma) and doesn't change even when the locale settings change, so what I get is always 1,234 (and should be 1.234 for English for example).

Is there any way to change this behaviour ? One suggestion I found is to use formula to retrieve separators, like:

if contentlocale="en_US" then '.' else ','

but then I would have to use it for all number fields in my report.

Can I somehow set separators programatically when calling report from Java (same as setLocale method)? Or is there any "abbreviation" for separators like in Oracle Reports (D for decimal, G for grouping - they change accordingly to locale settings)

thanks for all answers

regards

Maciej