Data binding E - Data binding to the general expression - configuration window
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 variable||In 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.
|Add||Adds new control variable to the end of the list.|
|Insert||Inserting new control variable above the selected variable.|
|Delete||Delete the selected control variable.|
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
, because such calling would initialize synchronous communication with the server causing intensive communication load on Web clients.
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 PROMOTIC application) - the evaluation is done on the client side (i.e. on the Web browser).
Simple expression containing two variables v1 and v2, multiplication, addition, division, subtraction and brackets.
2 * (v1 + 3) / 2 - v2
The expression returns String and contains conditional evaluation (? :). If v1 equals to 1, then the "start" is returned, otherwise "stop" is returned.
v1==1 ? "start" : "stop"
Expression returns the output of the sinus function.
The designer's method "MyMethod" of the Pmg object is called during the calculation.
More complex expression with multiple conditional evaluation (this kind of expression can sometimes replace by the "T - Data binding to calculation based on a table of values
" 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))
Example of linear value conversion
. This expression can replace the LN - Data binding as linear function calculation
data binding. Let the linear conversion be as follows (the values 80
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))
: 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.
: Fixed bug:
Sometimes caused excesive memory usage.