Display Formats for Numeric and Float Data

Display formats for numeric data typically apply a pattern to the data. For example, you can define the number of digits before or after the decimal point, put a currency symbol in front (or behind the value), or define whether the decimal and thousand separators should be commas or periods.

Note: Dynamic server pages support a subset of the display formats that can be used in forms, and have other formatting limitations. For more information, see Display Formats for Numeric and Float Data in Dynamic Server Pages.

You can set the NLS locale using the $NLS_LOCALE assignment setting or $nlslocale ProcScript function to a specific locale. This is used in desktop and server-based applications, and in server-side processing of dynamic server pages (DSPs).

You can override the behavior specified by NLS locale by setting $NLS_FORMAT or $nlsformat. For example, if $NLS_LOCALE is set to en_gb, that is English(United Kingdom), and you do not want the formatting of numeric and floating point fields to be affected by the locale, you can set $NLS_FORMAT to classic.

If $NLS_FORMAT (or $nlsformat) is set to nlslocale, and $NLS_LOCALE (or $nlslocale) specifies a locale (language and country) or system, the standard display formats are treated as $NLS(FormatPattern). This will affect the decimal separator, thousand separator, and currency symbol.

In dynamic server pages, these settings have no effect. Instead, you can use $webinfo("locale") to define the locale used for client-side formatting.

$NLS Display Formats for Numeric and Float

Setting NLS display formats applies the conventions regarding plus, minus, digits, decimal separator, thousand separator, and currency symbol that are applicable to the current locale.

Codes for Numeric Display Formats

The standard Uniface display formats explicitly apply a pattern of digits (with or without leading and trailing zeros), plus and minus signs, decimal location, separators.

For dynamic server pages, only the display format characters 9, z, P, and K are supported.

If a display format pattern consists of illegal characters (for example DIS(XXXX)), or it contains legal characters that are combined into an invalid display format (such as DIS(B.)), a compiler warning is issued, the display format is ignored, and the scaling defined by the database interface is applied.

Examples for illegal formats
Database Interface Display Format Input Value Formatted Value
I8.4 DIS(XXXX) 1234.123456

1234.1235

compiler warning 1136

I8.4 DIS(B.) 1234.123456

1234.1235

compiler warning 1136

Related Topics