Data binding E - Binding to the general expression

The result 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 is possible to define 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.

AddAdding new control variable to the end of the list.
InsertInserting new control variable above the selected variable.
DeleteDeleting 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, it is possible to use:
- object Pm: for example its mathematical and string methods. See the example Example3.
- object pMe: represents the graphic item containing this data binding. See the example Example4.

Caution: The pMe in this data binding can be used to get any value from any graphic item 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.

Caution: The expression is not defined in the VBScript syntax, because some usefull functions are not available there, for example conditional evaluation (in JavaScript for example the (v1 ? 2 : 3) expression, see Example2).
This data binding is also functional for 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 user method "MyMethod" of the graphic item is called during the calculation.
1 + pMe.Methods.MyMethod(v1)
More complex expression with multiple conditional evaluation (this kind of expression can sometimes replace the T - Binding to calculation based on a table of values data binding).
- if v1 equals to 0, then the result is 12
- if v1 equals to 1, then the result is 24
- if v1 equals to 2, then the result is 50
- otherwise the result is 0
v1==0 ? 12 : (v1==1 ? 24 : (v1==2 ? 50 : 0))
Example of linear value conversion. This expression can replace the LN - Linear function calculation binding data binding. Let the linear conversion be as follows (the values 80, 90, 5, 6 can be replaced by any other):
- if v1 equals to 80, then the result is 5
- if v1 equals to 90, then the 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 the result is still 5
- if v1 is greater or equal 90, then the result is still 6
v1<=80 ? 5 : (v1>=90 ? 6 : ((v1-80)*(6-5)/(90-80) + 5))
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice