Variant data type (LotusScript® Language)

Specifies a 16-byte variable that can contain data of any scalar type, an array, a list, or an object.

Usage

A variable that is declared without a data type or a suffix character is of type Variant.

Variant values are initialized to EMPTY.

A Variant variable can contain values of any scalar data type, or any of the following special values.

  • Array: A declared array may be assigned to a Variant variable. The reverse is not true; for example, a Variant variable containing an array may not be assigned to a declared array variable.
  • List: A list may be assigned to a Variant variable. The reverse is not true; for example, a Variant variable containing a list may not be assigned to a declared list variable.
  • Object reference: A reference to any instance of a user-defined class or product class, or to an OLE Automation object, may be assigned to a Variant variable.
  • Date/time value: An 8-byte floating-point value representing a date/time may be assigned to a Variant variable. The integer part represents a serial day counted from Jan 1, 100 A.D. Valid dates are represented by integer numbers in the range -657434 (representing Jan 1, 100 A.D.) to 2958465 (representing Dec 31, 9999 A.D.). The fractional part represents the time as a fraction of a day, measured from time 00:00:00 (midnight on the previous day). In this representation of date/time values, day 1 is the date December 31, 1899.
  • NULL: A Variant can take the value NULL either by explicit assignment, or by the evaluation of an expression containing NULL as an operand. (For most expressions, if one or both operands are NULL, the expression evaluates to NULL.)
  • EMPTY: In expressions, EMPTY is converted to 0 for numeric operations, and to the empty string ("") for string operations. Variants take the value EMPTY only upon initialization, or upon assignment from another Variant whose value is EMPTY.

A Variant cannot contain an instance of a user-defined type.

To determine the data type of the value in a Variant variable, use the DataType or TypeName function.

LotusScript® aligns Variant data on an 8-byte boundary. In user-defined data types, declaring variables in order from highest to lowest alignment boundaries makes the most efficient use of data storage space.

Example