I need to format several number field so they display various number of decimal places etc., while keeping correct separators for decimal and thousands depending on regional settings, i.e. - 1,234.567 (English) - 1.234,567 (German)
There is no problem if the number field can be displayed using System Default Number Format. But when I try to go deeper into Custom Style, problems start to appear. I am able to change the number of decimal places, but at the same time decimal and thousand separators are not changing, so when the report is executed they are same as defined (,.) no matter what locale I use (German or English). And I can't change them because they have to be displayed dynamically using the local setting.
Is this a bug in Crystal Reports (I use version 11)?
Is it possible to get the value of current decimal and thousand separator programaticaly and use it in formula? For example in Oracle Reports one is able to use D and G as separator, so the format mask looks like '999G999G999G990D000' - could it be done same in Crystal Reports?
In java which calls the report we use only setLocale method - maybe something else has to be used?
As far as I know there is no way to directly get the local systems symbols for thousands separator and decimal. You can, however, manually check the locale via the contentlocale
variable and select the appropriate formatting.
For example, to display a '.' as the decimal symbol for United States English, you could enter the formula if contentlocale="en_US" then '.' else ','