Friday, February 22, 2019

Tip of the Day: Enhanced DWRD function for Returning Fractional Whole Dollars
Product.......: R:BASE X.5 and R:BASE X.5 Enterprise (Version 10.5)
Build.........: 10.5.1.30214 or higher
Sections......: Functions
Keywords......: DWRD, Currency, Conversion, Fractional Dollar, ICAP3

Did you know the DWRD function was enhanced to allow for fractional whole
dollars to be returned for the cents portion of the word representation?

The DWRD function converts a currency value to its word representation.

(DWRD(value)) or (DWRD(value,arg))

The arg parameter is optional, which allows for fractional whole dollars
to be returned for the cents portion of the amount. The arg value as 0
will return cents in the word representation. The arg value as 1 will
return fractional whole dollars in the word representation. Omitting the
optional parameter is the same as 0 for the optional parameter.

-- Example 01:
SET VAR vAmount CURRENCY = 10.50
SET VAR v1 TEXT = (DWRD(.vAmount))
SHOW VAR v1
ten dollars and fifty cents

-- Example 02:
SET VAR vAmount CURRENCY = 10.50
SET VAR v1 TEXT = (ICAP3(DWRD(.vAmount)))
SHOW VAR v1
Ten Dollars and Fifty Cents

-- Example 03:
SET VAR vAmount CURRENCY = 10.50
SET VAR v2 TEXT = (DWRD(.vAmount,1))
SHOW VAR v2
ten and 50/100 dollars

-- Example 04:
SET VAR vAmount CURRENCY = 10.50
SET VAR v2 TEXT = (ICAP3(DWRD(.vAmount,1)))
SHOW VAR v2
Ten and 50/100 Dollars

-- Example 05:
SET VAR vAmount CURRENCY = 10.50
SET VAR v3 TEXT = (DWRD(.vAmount,0))
SHOW VAR v3
ten dollars and fifty cents

-- Example 06
SET VAR vAmount CURRENCY = 10.50
SET VAR v3 TEXT = (ICAP3(DWRD(.vAmount,0)))
SHOW VAR v3
Ten Dollars and Fifty Cents

Have fun!

Razzak.

https://www.rbase.com
http://www.facebook.com/rbase/


--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- You received this message because you are subscribed to the Google Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to