GetVarType - method of the Pm object
Description:
Returns the data type of the value.
Syntax:
Variant GetVarType(Variant vValue, [Long nMode])
Parameters:
vValue | (Variant) Any valid expression. |
nMode | [optional] (Long) Specifies the level of detail of data type detection (especialy for object):
0 (default) - If the value contains object, then its type is not being detected.
|
---|
Return value:
Returns object numeric code (see
GetVarType method code table) or one of the following strings, that specifies the data type of the value
vValue:
"undefined" - The value is not set.
"null" - The value that contains no valid data.
"number" - The value is a number.
The number type (integer or floating-point) and byte size are not distinguished. All number types are identified the same way here.
In order to detect whether it is an integer use the
Pm.IsInt method.
"boolean" - The value is a logical value
false or
true.
"string" - The value is a text string.
"vbarray" - The value is a
VBScript array.
"object" - If
nMode = 0, then the value is arbitrary object (the object type is not distinguished).
If
nMode = 1, then the value is object other than those listed objects.
"PmMap" - The value is object of the
PmMap type (only for
nMode = 1).
"PmArray" - The value is object of the
PmArray type (only for
nMode = 1).
"PmBuffer" - The value is object of the
PmBuffer type (only for
nMode = 1).
"PmForm" - The value is object of the
PmForm type (only for
nMode = 1).
"PmDateObject" - The value is object of the
PmDateObject type (only for
nMode = 1).
"PmAction" - The value is object of the
PmAction type (only for
nMode = 1).
If
nMode = 2.
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var sType = Pm.GetVarType(-3.14);
// Returns "number"
Dim sType
sType = Pm.GetVarType(-3.14)
' Returns "number"
Example2:
JavaScriptVBScriptSelect and copy to clipboard
if (Pm.GetVarType(aArr, 1) == "PmArray")
{
var val0 = aArr.GetItem(0);
}
If Pm.GetVarType(aArr, 1) = "PmArray" Then
Dim val0
val0 = aArr(0)
End If
Example3:
JavaScriptVBScriptSelect and copy to clipboard
var oItem = pMe.Items("/Txt2");
// 6110 = PmgString
if (Pm.GetVarType(oItem, 2) == 6110)
{
oItem.FontId = "PmBig";
}
Dim oItem
oItem = pMe.Items("/Txt2")
' 6110 = PmgString
If Pm.GetVarType(oItem, 2) = 6110 Then
oItem.FontId = "PmBig"
End If
History:
Pm9.00.25: The
nMode parameter has a new option
2 allows to specify that the object's numeric code will be returned.