(DWRD(value)) or (DWRD(value,arg))
Converts a currency value to its word representation.
The DRWD function results will differ based upon the CURRENCY symbol value.
With the CURRENCY symbol set to the dollar character ($), the DWRD results include "dollars" and "cents" in the word representation. With the CURRENCY symbol set to any other currency symbol (euro, franc, peso, etc.) including a blank, the DWRD results display fractional whole dollars in the word representation.
The arg parameter is optional, which allows for fractional whole dollars to be returned for the cents portion of the amount, even if the currency symbol is set to the dollar character. The arg value as 0 will return "dollars" and "cents" in the word representation. The arg value as 1 will return fractional whole dollars in the word representation. Using the DWRD arg parameter, users are not required to alter the CURRENCY symbol to display fractional whole dollars. Omitting the optional parameter is the same as 0 for the optional parameter. A non-zero optional parameter provides the fractional whole dollars.
Examples
Example 01:
-- Uses the dollar CURRENCY symbol
SET CURRENCY '$'
SET VAR vAmount CURRENCY = 10.50
SET VAR v1 TEXT = (DWRD(.vAmount))
SHOW VAR v1
ten dollars and fifty cents
Example 02:
-- Uses a blank CURRENCY symbol
SET CURRENCY ' '
SET VAR vAmount CURRENCY = 10.50
SET VAR v2 TEXT = (DWRD(.vAmount))
SHOW VAR v2
ten and 50/100
Example 03:
-- Uses the dollar CURRENCY symbol and returns fractional whole dollars
SET CURRENCY '$'
SET VAR vAmount CURRENCY = 10.50
SET VAR v3 TEXT = (DWRD(.vAmount,1))
SHOW VAR v3
ten and 50/100 dollars
Example 04:
-- Uses the dollar CURRENCY symbol and returns the word representation with the ICAP3 function
SET CURRENCY '$'
SET VAR vAmount CURRENCY = 10.50
SET VAR v3 TEXT = (ICAP3(DWRD(.vAmount,0)))
SHOW VAR v3
Ten Dollars and Fifty Cents