Input Variable Value

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.

Block

Text

onVariableInput(VARIABLE, ()=>{
                   1
});

1: Variable

Note:

  • 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)

  1. Create two Numeric Display objects.
  2. Add two variables DINT1 and DINT2 in the Variable editor.
  3. Assign DINT1 to the first Numeric Display object and DINT2 to the second Numeric Display object.
  4. Add a Input Variable Value trigger and set DINT1 as variable.
  5. Add a Value Change operation and assign DINT2 as object, [AddTo] as [Value Change] and 20 as parameter.
    → In display unit, every time you enter a value in the first Numeric Display object, the value in the second Numeric Display object is incremented by 20. Even if you enter the same value as the previous input, the value in the second numeric display shows an increment of 20.
Block
Text

onVariableInput(DINT1, ()=>{
DINT2 += 20;

});

Differences between [Input Variable Value] and [Value Change] Trigger

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.

Notes of Assigning Same Variable to [Input Variable Value] Trigger and the Connected Block

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.

Block

Text

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.

Block

Text

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