cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

faruksxd
Explorer
0 Kudos

It give me back "the formula result must be boolean" help more

Accepted Solutions (0)

Answers (1)

Answers (1)

JWiseman
Active Contributor
0 Kudos

hi Maciej,

if you want to do this in java please post your question to the forum here.

in crystal probably the best way to do this is to first create a custom function that include a case statement, taking in the locale, and then an output to a totext() format.

you could then quickly change the format of the number field by going to Format Field > Common tab and then Display String. the custom function would be called in this dialogue.

after you format one number then use the Format Painter to format the other number fields that you want to change.

-jamie