Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET CURRENCY, Set(“Currency”)

SET CURRENCY dictates the format in which currency values are displayed.

Usage

SET CURRENCY TO LEFT | RIGHT
SET CURRENCY TO cSymbol
cLeftOrRight = SET( "CURRENCY" )
cSymbol = SET( "CURRENCY", 1 )

SET CURRENCY specifies whether the currency symbol should precede or follow the number, and what that symbol should be. These settings are used for any numeric field where the Format property includes the “$” symbol, or if you’re using the TRANSFORM() function either on a currency value or with an “@$” format clause.

In VFP 5 and earlier, when the currency symbol is more than one character long and placed to the left of the number, it can be truncated if the InputMask does not provide sufficient space for the entire expression. For example, with currency set to "SEK" to the left of the number, TRANSFORM(12345.6789, "@$999999.9999") returns "K12345.6789" This was fixed in VFP 6.0.

Example

SET CURRENCY TO " DMK"
SET CURRENCY RIGHT
* The @$ function is the older equivalent of Format
@ 1,1 SAY 12345.6789 PICTURE "@$99999.9999"
* DISPLAYS "12345.6789 DMK"

SET(“CURRENCY”) returns either “RIGHT” or “LEFT”, while SET(“CURRENCY”,1) returns the currency symbol.

See Also

Configuration Files, Format, InputMask, Transform(), Set Point, Set Separator, Set SysFormats