The % variable is set from a GUI before executing an SQL query. It's used by one or more SQL procedure methods within an SQL query that can be called multiple times & with differing arguments within a single SQL query. The % variable value isn't passed in as an argument to the procedure methods as it is held in the % variable. The arguments to the methods are hard coded in the SQL query but the detail held in the % variable is dependant on what is selected in the GUI at the time of SQL query execution. The % variable holds the ID of an object that contains a number of properties that are used by the SQL procedure methods in the SQL query to lookup data specific to the query execution. This solution works well for queries executed within a single process.

There is already code in place to handle UNION %PARALLEL that relies on the ^%ISCWorkQueue global, which through my testing never appears to exist. The intention of the code is to take the parent PID of the worker (assumed to be the GUI triggered executing process) & use it to retrieve a value held in a global subscripted by the executing process PID & set the % variable equal to it.

e.g.
Executing Process PID = 12345
set ^MyGlobal(12345)=125
Child Process PID = 54321

From Child:
    set group = $g(^%ISCWorkQueue("Worker",$J))  /* $J = 54321 */
    set parentPID = $lg(^%ISCWorkQueue(group,"Settings"),1) /* Expecting parentPID = 12345 */
    %Variable = ^MyGlobal(parentPID) /* Expecting %Variable = 125 */

Therefore, if there is a way to retrieve the PID of the process that queued the unit of work (i.e. the Child) to the Work Queue then it could be job done.

With thanks,

Michael

Thanks for your replies.

@Eduard - Multiple Users could trigger these queries simultaneously with a different replicable value so storing it against the Work Queue Manager PID doesn't allow for the required flexibility.

@Benjamin - A % Variable holds the value that needs replicating across processes. The value is used in SQL procedure methods for lookups, among other things.

With thanks,

Michael