SetCurrencyFormat
Obsolete
A number of global format functions were added for the legacy WebApp (in gFormatNumers.pkg):
Function FormatNumber Global number nNum integer iPoints returns string
Function FormatCurrency Global number nNum integer iPoints returns string
Function FormatValue Global number nNum string sFmt returns string
Procedure SetCurrencyFormat Global string sFmt
Procedure SetNumberFormat Global string sFmt
These functions are only used by the legacy WebApp and not Windows. They should be considered obsolete. These do use "$" as a replacement for the regional currency symbol.
Purpose
The SetCurrencyFormat message sets the global currency format string. This currency format string can then be used by the FormatCurrency function to format number variables.
Syntax
Use gFormatNumbers.pkg
Send SetCurrencyFormat {sFormatString}
Where:
{sFormatString}operates very similarly to the DataDictionary masking strings.
The format string $,#.##;($,#.##) will insert thousand separators (commas) and currency symbols, and truncate the number to 2 decimal places. Negative numbers will appear within parentheses.
Token characters for sFormatString are:
$: currency symbol as defined by Windows,: thousands separator as defined by Windows.: decimal separator as defined by Windows;: separates the positive and negative format. If the negative format is omitted, the positive string is used with a preceding "-"#: represents a digit; the quantity of tokens only matters to the right of the decimal*: can be used to the right of the decimal, meaning any number of decimals
All other characters are constants and are printed as displayed. For example, the "(" and ")" for negative numbers.
If you wish to display a token as a literal, use a slash in front of it. For example, / would create $, even in Germany, regardless of the currency symbol defined by Windows.
Many tokens use locale information; therefore, the results will differ depending on your Regional Setting Properties for Currency.
What it Does
Allows you to create a custom format string (mask) that can then be used to format numbers. The formatting of numbers is accomplished by the FormatCurrency function when it uses the -2 parameter.
Send SetCurrencyFormat ",#.## $;,-#.## $"
Move (FormatCurrency(nNumber, iPoints)) to sString
This would result in 123.222,22 € and -123.222,22 € with German settings, but 123,222.22 $ and -123,222.22 $ with USA regional settings.
Notes
-
SetNumberFormatandFormatNumberdo not apply a number format globally to data entry objects (DEOs) connected to Data Dictionary Objects (DDOs). The number formats set like this apply only to numbers not manipulated via DEOs and DDOs. Use Form_Mask and Form_DataType for masking of DEOs. -
Normally, changing the format will be required only once in a program. However, you can change it as often as you need.
-
The
SetCurrencyFormatis almost identical to theSetNumberFormat, but its format string is for a numeric mask, whereas this mask is for a standard currency format string.