The Input Variable Value trigger runs the operation when a value is input to the selected variable from the display unit.
This trigger occurs even if the input value is same as the current value.
onVariableInput(VARIABLE, ()=>{
1
});
1: Variable
When the value is input to the external variable from not the display unit but the device address of the external device directly, the trigger does not run.
When the external variable quality status is other than
good, the trigger does not run even though the value is input
to the external variable. You can monitor the variable quality
status from the source property (<Variable Name>.Quality).
Variables
(Example)
onVariableInput(DINT1,
()=>{
DINT2 += 20;
});
You can also use [Value Change] trigger which has functions similar to [Input Variable Value] trigger. If [Input Variable Value] trigger does not meet your demands, please consider using [Value Change] trigger.
The following describes the differences between both triggers.
[Input Variable Value] | [Value Change] | |
Target of the trigger | Variables only | Variables and source properties |
When the value is input to the external variable from the device address directly: | Trigger does not run. | Trigger runs. |
When the same value as current value is input: | Trigger runs. | Trigger does not run. |
When you use the same external variable other than slave device driver is assigned to [Input Variable Value] trigger and the connected block, not the input value but the current value may be referred from the connected block.
onVariableInput(Var1, ()=>{
$GraphicObject.NumericDisplay2.CurrentValue = Var1;
});
Variable Type | Driver | Use of Asynchronous Type Operation *2 | Referred Variable Value from Connected Block |
Internal Variable | - | Yes | Input Value |
No | Input Value | ||
External Variable | Slave Device Drivers *1 | Yes | Input Value |
No | Input Value | ||
Other Than Slave Device Drivers | Yes | Input Value | |
No | Current Value (before the value is input) |
*1 Slave device drivers include:
*2 In case of inserting asynchronous type operation between [Input Variable Value] trigger and the target operation.
onVariableInput(Var1, ()=>{
exportAlarmData(false, false, $Enums.AlarmMode.Log);
$GraphicObject.NumericDisplay2.CurrentValue = Var1;
});
For more details of asynchronous
type operation, refer the following.
Operation Block
If you fall under the item at the bottom of the table, please consider
whether you can use [Value Change] trigger instead of [Input Variable
Value] trigger.
For more details about differences between [Value Change] trigger and [Input
Variable Value] trigger, refer to the "Differences between [Input
Variable Value] and [Value Change] Trigger" in this topic.
For more details about [Value Change] trigger, refer to the following.
Value Change