Developer Documentation Library > Scripting > UNICOM Intelligence Function Library > Miscellaneous functions > VarTypeName
 
VarTypeName
Returns a string indicating the type of a variable.
Syntax
VarTypeName(Val, [TypeDescription]))
Parameter
Val
Type: Long
The data value.
TypeDescription
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 Val.
Remarks
The return value is a string representing the type of Val.
Return value
Type of val
"None"
None (Val is NULL)
"Long"
Long
"Text"
Text
"Categorical"
Categorical
"Object", or if TypeDescription is True, the type of object
Object
"Date"
Date
"Double"
Double
"Boolean"
Boolean
If Val 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