RunGlobalProcedureOnTrigger
- Last UpdatedOct 29, 2026
- 2 minute read
This function runs a global procedure when the value or quality of a specified tag changes.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
RunGlobalProcedureOnTrigger |
Module Activity |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Not supported |
Syntax
RunGlobalProcedureOnTrigger("strTagName", strProcedureOnTrigger)
strTagName
The name of a project tag.
Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.
strProcedureOnTrigger
The name of the procedure (a VBScript function or subroutine defined in the VBScript Global Procedures) to run when the value or quality of the specified tag changes.
Returned value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Error |
|
1 |
Success |
Notes
Once this function is called, it is continuously executed by the project runtime client (that is, the Viewer) until either it or the project runtime server is stopped. That means every time the value or quality of the specified tag changes, the procedure is run. Also, the function can be called more than once, so that the same procedure can be run by different triggers. The project runtime client manages the execution of all instances of the function.
Tip: The procedure is run on the client where the function was called. To run a procedure on the server, use the function RunGlobalProcedureOnServer.
The value or quality of the specified tag is passed to the procedure as an argument, so the procedure should be written to receive it. For example:
Sub MyProcedure(strTrigger)
.
.
.
End Sub
In practice, this means either…
strTrigger = $tagname->Value
…or…
strTrigger = $tagname->Quality
…depending on which one changed. You can then use the value or quality in your procedure.
Please note that you do not actually have to use the argument, only that you should write the procedure to receive it.
No other arguments can be passed to the procedure.
To ensure compatibility with previous versions of Edge HMI, passing the argument is disabled by default in existing projects and enabled by default in new projects. To change this for your project, open your project file (<project name>.APP) in a text editor and then edit the following property:
[Options] EnableTagNameOnRunGlobalProcedureOnTag=<0 (disabled) / 1 (enabled)>
Examples
When the value or quality of the tag MyInteger changes, run the procedure MyProcedure:
RunGlobalProcedureOnTrigger("MyInteger", "MyProcedure")
The equivalent of MyInteger->Value or MyInteger->Quality, depending on which one changed, is passed to the procedure as an argument.