Locale-sensitive expressions
Expressions in Cognos Analytics - Reporting are locale-dependent and need to use locale-specific characters as list separators and decimal separators, as defined in the ISO standard.
The Cognos Analytics default format values are based on the ISO standard for specific locales. If changing the report locale, the expressions need to be updated accordingly, depending on the rules for the locale.
For example, if the Content language in user preferences is set to French, German, English (South Africa), and most
European languages, the expressions must use the semicolon (;) character as a list separator in
functions such as cast
, or other functions that contain a list of parameters in
their definition. For these languages, the following examples use the correct list separator:
TRIM ( cast([in-1] ; char(6)) ) || (' - ') || TRIM ( [description] )
cast([SQL1].[day_date] ; date)
Using a different character as a list separator for these languages would result in a validation error. To resolve the error, you could change the list separator to the semicolon (;), and save the expression.
For numeric values, the character that is used as a decimal separator is also locale-dependent.
For example, in most languages, the decimal separator is the period (.) character. However, in
French the decimal separator is a comma (,). Processing the expression
coalesce(2,3)
returns the numeric value of 2 in English. The same expression
returns the value of 2,3 in French.
Resolving locale-related problems with list separators and decimal separators
To avoid problems with list separators and decimal separators in expressions, use a semicolon (;) as a list separator in any locale, and a period (.) as a decimal separator in any locale.
If a validation error occurs, edit the expression in the expression editor by replacing the list separator or decimal separator characters with characters that are supported for your locale.
If you don't want to use the ISO-defined defaults for list separators and decimal separators, you can override them in the i18n_res.xml configuration file in the following way:
- Open the cognos_analytics_install\configuration\i18n_res.xml file in a text editor.
- Find the line
<locale csvEncoding="windows-1252" lcid="7177">locale_name</locale>
for the locale you want to modify.For example, for the en-za locale, find
<locale csvEncoding="windows-1252" lcid="7177">en-za</locale>
. - Edit this line by adding the following parameters with the changed characters for the list
separator and decimal separator:
decimalSeparator="value"
listSeparator="value"
groupingSeparator="value"
For example, for the en-za locale, the line can be modified in the following way:
<locale csvEncoding="windows-1252" lcid="7177" decimalSeparator="." listSeparator="," groupingSeparator=",">en-za</locale>
.The list separator for the en-za locale is now a comma (,), and the decimal separator is a period (.).
- Restart the Cognos Analytics service.