Try OpenEdge Now
skip to main content
Internationalizing Applications
Preparing the Code : Data-processing issues : Numeric formats
 

Numeric formats

Numeric data has a cultural component that any international OpenEdge application must address. Numeric separators (decimal and thousands separators) differ across locales. The following table shows how various countries use periods (.), commas (,), and spaces in numeric values.
Table 5. International numeric formats
Country
Thousands separator
Fractional separator
Example
France
Space
Comma (,)
1 000 000,00
Germany
Period (.)
Comma (,)
1.000.000,00
United Kingdom
Comma (,)
Period (.)
1,000,000.00
Internally, OpenEdge expects all numeric data to follow the United States standard, which uses a period as a decimal separator and a comma as a thousands separator. Your application code must follow these standards when specifying data. However, an application can accept input and display data in the European format if you start the client session with the European Numeric Format (-E) startup parameter.
If your application handles data from various locales, it must have consistent standards for storing and manipulating numeric data. For example, you might want to implement a single application that allows a manager in Rome to enter data using one format while a manager in Tokyo enters data using another format. No matter the format used for entering data, OpenEdge stores DECIMAL data in a neutral format. However, any references to numeric values in code, such as decimal constants or in the Data Dictionary, must use the period as a decimal separator and the comma as a thousands separator, as the following code shows:
DEFINE VARIABLE price  AS DECIMAL NO-UNDO.
DEFINE VARIABLE price1 AS DECIMAL NO-UNDO.
...
price1 = price * .10.
DISPLAY price1.
When you run this code with the -E startup parameter, the value of price1 displays with a comma as the decimal separator.
Within an application, you can also use the NUMERIC-FORMAT attribute of the SESSION handle. It indicates whether periods and commas follow the American convention or the European convention. The American convention uses commas to indicate thousands and periods to indicate decimals. The European convention uses periods to indicate thousands and commas to indicate decimals.