RunGlobalProcedureOnServer
The function RunGlobalProcedureOnServer runs a specified VBScript procedure, as defined in the Procedures folder in the Project Explorer. The procedure is run on the project runtime server, but it can be triggered by any client that calls this function.
Function | Group | Execution | Windows | Embedded | Thin Client | Mobile Access |
---|---|---|---|---|---|---|
RunGlobalProcedureOnServer | Module Activity | Synchronous | Supported | Supported | Supported | Supported |
Syntax
RunGlobalProcedureOnServer(strProcedureName,optStrArgument1,…,optStrArgumentN)
- strProcedureName
- The name of the procedure (i.e., a VBScript function or sub-routine defined in the Procedures folder) to run on the project runtime server.
- optStrArgument1,…,optStrArgumentN
- Values that are passed to the procedure’s parameters. Arguments must be passed as strings, but the procedure will interpret them as the correct data types. For more information, see “Examples” below.
Returned value
This function returns whatever value that is returned by the procedure.
Notes
If the option Enforce Web functionality equivalence is selected in the project settings, this function cannot be called from Global Procedures or Script worksheets. This is because the function is meaningful only when it is executed on stations that display project screens; it might cause unexpected behavior if it is called from background tasks that are executed on the project runtime server. For more information, see Preferences tab.
Also, you cannot call this function in a procedure that was itself run by calling the function RunGlobalProcedureOnServer. If you attempt to do so, then the function will return an error. This is to prevent a possible memory leak caused by nested or recursive function calls.
You can still call other procedures directly, as you normally would in VBScript, or you can use the function Eval in VBScript to dynamically determine the procedure you are calling.
Examples
Function AddMe(intNumber) If intNumber >= 6 Then AddMe = 0 Else AddMe = intNumber + 2 End If End Function
…the procedure is run by calling the function RunGlobalProcedureOnServer…
RunGlobalProcedureOnServer("AddMe","2")
…and it returns a value of 4.