Returns the data type of the value of an expression.
DataType ( expr )
VarType is acceptable in place of DataType.
expr
Any expression.
DataType returns a number representing the data type of expr.
The following table describes the possible return values. The first column is the return value. The last column is "Yes" if the return value applies to variants only.
Return |
Value type |
Constant |
Variants only |
---|---|---|---|
0 |
EMPTY |
V_EMPTY |
Yes |
1 |
NULL |
V_NULL |
Yes |
2 |
Integer |
V_INTEGER |
|
3 |
Long |
V_LONG |
|
4 |
Single |
V_SINGLE |
|
5 |
Double |
V_DOUBLE |
|
6 |
Currency |
V_CURRENCY |
|
7 |
Date/Time |
V_DATE |
Yes |
8 |
String |
V_STRING |
|
9 |
OLE object or NOTHING |
V_DISPATCH |
Yes |
10 |
OLE error |
V_ERROR |
Yes |
11 |
Boolean |
V_BOOLEAN |
|
12 |
Variant list or array |
V_VARIANT |
|
13 |
IUNKNOWN (OLE value) |
V_IUNKNOWN |
Yes |
17 |
Byte |
V_BYTE |
|
34 |
User-defined object |
V_LSOBJ |
|
35 |
Product object |
V_PRODOBJ |
|
2048 |
List |
||
8192 |
Fixed array |
||
8704 |
Dynamic array |
The file lsconst.lss defines the constants described in the preceding table. If you want to refer to the return values as symbolic constants instead of numbers, use the %Include directive to include this file in your script.
If the argument to DataType is a list or an array, the return value is the sum of the value that represents a list or an array plus the value that represents the data type of elements of the list or array. For example, a fixed array of Integers is 8194 (that is, 8192 + 2); a list of Variants is 2060 (that is, 2048 + 12).
The return value 13 signifies an unknown value type, corresponding to the OLE value IUNKNOWN. To test for this value, use the IsUnknown function.
@IsNumber function in formula language
@IsTime function in formula language
@IsText function in formula language