Update cookies preferences
Promotic

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.
1 - If the value contains object, then it is detected whether it is one of the following Pma objects: PmMap, PmArray, PmBuffer, PmDateObject, PmAction or PmForm.
2 - Returns numeric code of the object or data type. See GetVarType method code table.
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.
- For the JavaScript language, the value is null.
- For the VBScript language, the value is Null or Nothing.
"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.
code - Returns numeric code of the object or data type. See GetVarType method code table.
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.
Example1:
JavaScriptVBScriptSelect and copy to clipboard

var sType = Pm.GetVarType(-3.14);   // Returns "number"
Example2:
JavaScriptVBScriptSelect and copy to clipboard

if (Pm.GetVarType(aArr, 1) == "PmArray")
{
var val0 = aArr.GetItem(0);
}
Example3:
JavaScriptVBScriptSelect and copy to clipboard

var oItem = pMe.Items("/Txt2");
// 6110 = PmgString
if (Pm.GetVarType(oItem, 2) == 6110)
{
oItem.FontId = "PmBig";
}

History:
Pm9.00.25: The nMode parameter has a new option 2 allows to specify that the object's numeric code will be returned.
Pm8.03.13: New nMode parameter
Pm8.02.01: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- GetVarType
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r.o.