Data Model > Accessing the UNICOM Intelligence Data Model > Working with the Case Data Model > General information > Locale handling in the UNICOM Intelligence Data Model
 
Locale handling in the UNICOM Intelligence Data Model
Different formatting conventions are used in different countries for dates and times and for the decimal and thousands separators used in numeric data. The UNICOM Intelligence Data Model therefore uses the locale setting to parse date, time, and numeric data. When inputting data it is important that you use the date and time formats, decimal symbols, and so on, appropriate to the locale you are using. (You select the locale using Regional Options in the Windows Control Panel.)
The Case Data Model handles locale settings using two Connection properties:
MR Init Input Locale
Specifies the locale used when case data is inserted or updated. The input locale is used when converting text representations of numbers and dates to numeric and date types.
MR Init Output Locale
Specifies the locale used to output data and present errors. The output locale is used when converting numbers and dates to text and when presenting error messages.
Typically, both the input and output locale are the same. A distinction is made between the two to handle situations where, for example, an interview is presented in one language and answered in another.
If one of these connection properties is not specified, the locale ID is selected as follows:
language neutral
the thread's locale value
the user's default locale value
the system default locale value
US English.
When a locale ID is not specified, the user's regional settings override the locale ID selected by the system. Conversely, if a locale ID is specified, the default regional settings for that locale ID are used and the user's regional settings have no effect.
The UNICOM Intelligence Data Model stores the data in US English format. However, the locale handling means that this is normally invisible to the user.
Locale handling of numeric and date literals
A literal is a string of characters that represents a value. Literals are often used in expressions when you want to compare values. For example, the following expression uses a literal to select respondents whose income is above a specified value:
Income > 10000.00
The parsing of literals is always based on US English and is not dependent on the locale. This applies to both the UNICOM Intelligence Data Model and mrScriptBasic. This means that you must always specify date, time, and numeric literals in US English format. For example, the following expressions will give the desired results regardless of your locale:
DataCollection.FinishTime > "26 July 2002"
And Income >= "20000.00"
DataCollection.FinishTime > "26 July 2002"
And Income >= 20000.00
The following expression uses Danish date and number formatting, and always gives incorrect results even when the locale is Danish:
DataCollection.FinishTime > "26 juli 2002"
And Income >= "20000,00"
The following expression also uses Danish date and number formatting, and gives a syntax error. For example, in an SQL query the comma (,) in the numeric literal is interpreted as a column delimiter:
DataCollection.FinishTime > "26 juli 2002"
And Income >= 20000,00
However, the parameters to the functions in the UNICOM Intelligence Function Library are parsed using the locale. This means that you can use the conversion functions to convert locale-specific date, time, and numeric values. For example, this expression gives the desired results in a Danish locale:
DataCollection.FinishTime > CDate("26 juli 2002")
And Income >= CDouble("20000,00")
The above examples show how to use literals in UNICOM Intelligence Reporter, mrScriptBasic, or mrScriptMetadata. In an SQL query, replace " " (double quotation marks) with ' ' (single quotation marks). For example:
DataCollection.FinishTime > CDate('26 juli 2002')
And Income >= CDouble('20000,00')
See also
Identifier naming conventions
Rules for regular identifiers
Data types
Data type conversions
System variables
General information