In QuickHMI it is possible to execute JavaScripts when variables change.
These functions are subject to the same restrictions as scripts for control element events.
However, in this case the args parameter contains a variable object. Its properties can be accessed as follows:
| args[“variable”][“name”] (args.variable.name) | Returns the name of the variable. |
| args[“variable”][“datasource_name“] (args.variable.name) | Returns the name of the data source for the variable. |
| args[“variable”][“value”] (args.variable.value) | Returns the current value of the variable. |
| args[“variable”][“lastvalue”] (args.variable.lastvalue) | Returns the old value of the variable. |
| args[“variable”][“quality”] (args.variable.quality) | Returns the current quality of the variable. |
| args[“variable”][“timestamp”] (args.variable.timestamp) | Returns the time of the last change. |
Assigning functions to variables
The easiest and most flexible way to assign an event function to a variable is directly from the JavaScript using the Events.onVarChanged function.
However, assignment is also possible via the graphical user interface.
