Home > Class Reference > ENSLIB namespace > %Library.Currency

%Library.Currency

datatype class %Library.Currency extends %Library.DataType

ODBC Type: NUMERIC

The %Currency data type class represents a currency value.

%Currency is essentially the same as the %Numeric data type with clientdatatype of CURRENCY and a fixed SCALE of 4. It is a legacy type that is defined only for the purpose of moving existing applications from Sybase and SQL Server to Cache.

Method Inventory (Including Private)

Parameters

parameter DISPLAYLIST;
Used for enumerated (multiple-choice) attributes. Used in conjunction with the VALUELIST parameter for enumerated (multiple-choice) attributes. DISPLAYLIST, if not null, represents the display values for the attribute corresponding with the logical values listed in VALUELIST.

The display values are returned by the LogicalToDisplay method.

parameter FORMAT;
The format specification for the data type's display value.

The value of FORMAT corresponds to the formatting option of the $FNUMBER function, which is used to perform the formatting.

parameter MAXVAL;
The maximum allowed logical value for the data type.
parameter MINVAL;
The minimum allowed logical value for the data type.
parameter VALUELIST;
Used for enumerated (multiple-choice) attributes. VALUELIST is either a null string ("") or a delimiter separated list (where the delimiter is the first character) of logical values. If a non-null value is present, then the attribute is restricted to values in the list, and the validation code simply checks to see if the value is in the list.
parameter XSDTYPE = decimal;
Declares the XSD type used when projecting XML Schemas.

Methods (Including Private)

classmethod DisplayToLogical(%val As %String) as %Currency
Converts the input value %val, which is a string representing a currency value, into a logical currency value.

Returns the value of the input string %val as a currency (fixed point number).

classmethod IsValid(%val As %CacheString) as %Status
Tests if the logical value %val, which is a currency value, is valid. The validation is based on the class parameter settings used for the class attribute this data type is associated with. In this case, MAXVAL and MINVAL.
classmethod LogicalToDisplay(%val As %Currency) as %String
Converts the value of %val, which is in currency format, into a display string.

Returns the formatted value of %val.

classmethod Normalize(%val As %CacheString) as %Numeric
Converts %val to a normalized value.
classmethod XSDToLogical(%val As %String) as %Currency
Converts the SOAP encoded input decimal value into a Cache %Currency value. Returns "" for error.