Skip to content

Currency

See Also: Declaring Variables, Variable Declaration Commands, Struct, Number, Decimal

Purpose

Declares one or more Currency variables.

Syntax

To declare currency variables:

Currency {identifier} [{identifier}]

Where:

  • {identifier} is the name of a new Currency variable. The first {identifier} is required.
  • {identifier} may be between 1 and 4096 characters in length, must start with a letter, and may not contain spaces. Recommended characters are 0-9, a-z, A-Z, and _ (underscore).

To declare array variables of type Currency:

Currency {dimension-list} {identifier} [{identifier}]

Where:

  • {dimension-list} is a list of one or more array dimensions for the array. A dimension list is declared using square brackets []. One pair of brackets is used to declare each dimension. If the array is static, then you must specify the static size of each dimension between each pair of brackets, i.e., [{size}]. For more information about declaring arrays, refer to Array Variable Assignments.
  • {identifier} may be between 1 and 4096 characters in length, must start with a letter, and may not contain spaces. Recommended characters are 0-9, a-z, A-Z, and _ (underscore).

What It Does

The Currency command declares Currency variables, the range of which is from -922337203685477.5808 to 922337203685477.5807 (-922,337,203,685,477.5808 to 922,337,203,685,477.5807).

The Currency type is useful for storing fixed-point numbers with 4 or fewer digits to the right of the decimal point and up to 14 to the left. The purpose of this data type is to facilitate integration with COM and ODBC.

Multiple variables may be declared on one command line, with their names separated from each other by spaces.

Examples

Procedure DoTest
    Currency cyMyVar
    Move 1234.56 To cyMyVar
    Send Info_Box (String(cyMyVar))
End_Procedure

This example declares a currency variable named cyMyVar, moves 1234.56 to it, and displays it in a message box.

Currency[] cyBalances

This example declares one dynamic array variable, named cyBalances, containing an undefined number of elements of type Currency.

Currency[5] cyBalances

This example declares one static array variable, named cyBalances, containing 5 elements of type Currency.

Currency[][3] cyBalances

This example creates a two-dimensional dynamic array variable named cyBalances, containing an undefined number of elements of type Currency. Conceptually, this represents a rectangular array with an undefined number of rows, each of 3 columns.

You can declare dynamic multi-dimensional arrays where all dimensions are dynamic; these are called jagged arrays.

Notes

  • If you need to define a global Currency variable, you should use the global_variable command to do so.