Update cookies preferences
Promotic

Data binding E - General expression - configuration window

Description:
The value of the data binding is a value obtained by evaluating general expression. The value can be a number (Integer, Single ..), Boolean or String.
Data binding configurators:
Control variableIn this field it can be defined the control variables. The first variable is named v1, the second v2, etc. The variable names are then used in the general expression.
The data binding is defined for each variable, which is evaluated right before calculaing the general expression.
AddAdds new control variable to the end of the list.
InsertInsert new control variable above the selected variable.
DeleteDelete the selected control variable.
JavaScript expressionExpression written in the JavaScript language syntax. See The JavaScript operators and syntax description.
Macro expression can be used for input (it is evaluated while the window is opening).

In the expression can be used:
- object Pm: for example its mathematical and string methods. See the example Example3.
- object pMe: represents the Pmg object containing this data binding. See the example Example4.
Caution: The pMe parameter in this data binding can be used to get any value from any Pmg object of this panel. However this should not be used for calling pMe.PmPanel.Methods, because such calling would initialize synchronous communication with the server causing intensive communication load on Web clients.
Note:
This data binding is also functional in Web panels. The evaluation of the data binding does not need to communicate with the Web server (with the PROMOTIC application) - the evaluation is done on the client side (i.e. on the Web browser).
Example1:
Simple expression containing two variables v1 and v2, multiplication, addition, division, subtraction and brackets.
2 * (v1 + 3) / 2 - v2
Example2:
The expression returns a value of the String type and contains conditional evaluation (? :).
If v1 has the value 1, then returns the "start" value, otherwise returns the "stop" value.
v1==1 ? "start" : "stop"
Example3:
Expression returns the value of the sinus function.
Pm.Sin(v1)
Example4:
The designer's method "MyMethod" of the Pmg object is called during the calculation.
1 + pMe.Methods.MyMethod(v1)
Example5:
More complex expression with multiple conditional evaluation (this kind of expression can sometimes replace by the "T - Elementary table" data binding).
- if v1 is equal to 0, then result is 12
- if v1 is equal to 1, then result is 24
- if v1 is equal to 2, then result is 50
- otherwise result is 0
v1==0 ? 12 : (v1==1 ? 24 : (v1==2 ? 50 : 0))
Example6:
Example of linear value conversion. This expression can replace the "LN - Linear function" data binding.
Let the linear conversion be as follows (values 80, 90, 5, 6 can be replaced by any other):
- if v1 is equal to 80, then result is 5
- if v1 is equal to 90, then result is 6
(v1-80)*(6-5)/(90-80) + 5

The following conditions can also be added
- if v1 is less or equal 80, then result is 5
- if v1 is greater or equal 90, then result is 6
v1<=80 ? 5 : (v1>=90 ? 6 : ((v1-80)*(6-5)/(90-80) + 5))

History:
Pm8.03.12: In expression, it is possible to use also the pMe variable (object containing this data binding). This variable can be used in the expression to refer to any property of any Pmg object in this panel.
Pm8.01.05: Fixed bug: Sometimes caused excesive memory usage.
Pm8.01.01: Created
PROMOTIC 9.0.28 SCADA system documentation MICROSYS, spol. s r.o.

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