Xbasic

printCurrency Function

Syntax

P printCurrency(N number, C currencySymbol, N decimal_places [, C thousands_separator [, C decimal_separator [, L TrailingCurrencySymbol [, L blankIfZero [, C cssStyle]]]]])

Arguments

numberNumeric

The number value representing the amount

currencySymbolCharacter

The currency symbol string. For a list of currency codes, see ISO 4217 Currency Codes (wikipedia).

decimal_placesNumeric

The number of decimal places to print

thousands_separatorCharacter

The character to use as a thousands separator ("," in the U.S.)

decimal_separatorCharacter

The character to use as a decimal separator ("." in the U.S.)

TrailingCurrencySymbolLogical

Set to .T. if the currency symbol should trail the value rather than lead the value

blankIfZeroLogical

Set to .T. if a blank should display when the value is 0

cssStyleCharacter

Any CSS style override settings to use for the currency string

Description

Used in a report to print an international currency symbol. If you print to PDF be sure to set PDF options to allow 'Multilingual support'.

Discussion

The printCurrency() function can be used in reports to format a numeric value as currency for the specified country. Countries are specified using the ISO 4217 currency code format

For example, to print a 'price' field using the Nigerian Naira symbol, you would define the following calculated field in the report:

calcfield1 = printCurrency(price,"NGN",2)

You can print a list of countries and their corresponding currency codes in the Interactive Window by running the following Xbasic:

?a5_currencyCodes("country_currencycode")
= Albania, Leke=ALL
America (United States of America), Dollars=USD
Afghanistan, Afghanis=AFN
Argentina, Pesos=ARS
Aruba, Guilders (also called Florins)=AWG
Australia, Dollars=AUD
Azerbaijan, New Manats=AZNa
Bahamas, Dollars=BSD
...

See Also