Developer Documentation Library > UNICOM Intelligence Function Library > Miscellaneous functions > VarTypeName
 
VarTypeName
Returns a string indicating the type of a variable.
Syntax
VarTypeName(<value>, [<type_description>]))
Parameter
<value>
Type: Long
The data value.
<type_description>
Type: Boolean
Optional: If True and the return value is “Object”, descriptive type information is returned. If omitted or False, “Object” is returned.
(return)
Type: Text
The type of <value>.
Notes
The return value is a string representing the type of <value>.
Return value
Type of val
"None"
None (<value> is NULL)
"Long"
Long
"Text"
Text
"Categorical"
Categorical
"Object", or if <type_description> is True, the type of object
Object
"Date"
Date
"Double"
Double
"Boolean"
Boolean
If <value> has any other type, an error occurs.
This function is similar to the TypeName function in Visual Basic.
Example
The following mrScriptBasic example uses the VarTypeName function to determine the type of a variable:
Dim MyTest, MyVar

MyVar = 34
MyTest = VarTypeName(MyVar) ' Returns "Long"

MyVar = "Hullo"
MyTest = VarTypeName(MyVar) ' Returns "Text"

MyVar = {1, 2, 3, 4}
MyTest = VarTypeName(MyVar) ' Returns "Categorical"

Set MyVar = CreateObject("TOM.Document")
MyTest = VarTypeName(MyVar) ' Returns "Object"
MyTest = VarTypeName(MyVar, True) ' Returns "TomLib.Document"
See also
VarType
Miscellaneous functions