Promotic

SetVar - method of the PmExpr object

Description:
Adds one variable into the object.
Syntax:
Empty SetVar(Variant Name, Variant Value)
Parameters:
Name(Variant) Name of added variable (case sensitive text)
Value(Variant) Value of added variable
Note:
This method is also functional in Web panels.

This method adds one variable in the form of "name and value" into the PmExpr object. The method can be called multiple times over the same object - thus adding multiple variables into the object.
The names of added variables can then be used in the expression that is inserted into the object by the SetExpr method. The Eval method then evaluates the expression by filling in the value of the variable in the place of the variable name.
See also:
- PmExpr.SetExpr (method)
- PmExpr.Eval (method)
Example1:
JavaScriptVBScriptSelect and copy to clipboard

var val;
var oExpr = Pm.CreatePmExpr();
oExpr.SetExpr("a+b");
oExpr.SetVar("a", 3);
oExpr.SetVar("b", 2.5);
val = oExpr.Eval();

History:
Pm8.03.20: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.