Passing Input Variables as Reference to Multiple Nested Sub-Processes

Hi All,

I have a boolean variable in my initial process that I need to reference in a sub- sub- sub- process, is this possible? Can you pass a single variable through 3 process models to be used by the 4th based on the value from the 1st?

It's difficult to explain, but I need to know whether or not the initial process was scheduled or ad-hoc (the boolean value) in the 4th sub-process of this overarching process in order to make appropriate task assignments in the last model. 

I passed the variable as reference in the Sub-Process node of the 1st model, but when I try to do it again in the 2nd sub-process the variable doesn't appear as an input variable even after hitting Refresh. 

Thanks for more info! 

  Discussion posts and replies are publicly visible

  • The only difference with Pass by reference is that the variable will be pointing to the same memory address.

    To access the pv address from level 1 process in level 4 process model, you have to pass it to each level in between by reference also.

    I did try this just now and I was able to select the pv. For debugging you issue, I recommend checking if the PV is a parameter and of same type - multiple vs single etc.
  • Hi Sarah, you can pass a variable to the subprocess and its subprocess. But make sure, you create the same variable and select the first option in the parameter(i.e Allow the values for the variable..........) options. This will allow you to map the variable in the subprocess node inputs.
  • Hi,
    Your use case describes needing to know in the sub process whether or not the parent process was scheduled or ad hoc.
    Does this variable’s value change over the life of the process? I expect a given instance is scheduled, or ad hoc, but not both.
    Unless this variable’s value is going to change in the given instance after the sub process launches, by-reference mapping shouldn’t be necessary.
  • When I go to select the PV to pass into the next process model it does not appear -- it only appears in the original PM as an option but none of the other Sub-Process nodes in the later models. Even when I set it as a Parameter in the first model with all the same options. Am I missing something else?

    In this model above (first sub-process), the boolean variable is appearing in the Process Model Properties > Process Variables (presumably bc I passed it as reference from the parent process)-- but in the next sub-process node in this model, the variable does not appear (see above screenshot), even after refreshing. How come it's not seeing the Process Variable or making it available in the Sub-Process Node set up? 

  • Hi Robert -- you are correct that the value will only be one or the other, not both. If I don't pass the variable down into the 4th process model, how would I use it to assign the Task based on this variable then? The node for assignment I want to configure is in the last process and needs to know whether or not the start of the parent process was scheduled or ad-hoc. I think in this case mapping would be the only way to get that value?
  • Hi Sarah -

    So, 2 things:
    1st, I think I misunderstood your question, and that you were interested in using the setting "Pass as a reference" that synchronizes values in real time between processes. Reading again, it sounds like your key concern is passing the variable down from parent process to child process, again and again.
    Sorry about that.

    2nd, on to your real issue.
    Each sub process node is examining the condition of the parameter process variables in the target process.
    If you're hoping to map to a Boolean PV in the sub process, create a PV of type Boolean, e.g. myBool, and make sure to set it as a parameter so it can accept input values on process start. Then be sure to do a save and publish on that child (sub) process.
    After the save and publish, you should see the variable for mapping in the sub process node of the parent process.
    Since you have a number of sub processes, might want to start at the sub-most process, creating the PV, saving and publishing, and then mapping the variable in the parent process, and so on.

    Does that make sense?

    Thanks,
    Rob
  • Hi Rob, no problem, and thanks for the additional suggestions. So this worked -- I added the boolean manually into the sub-processes Model Variables > published and then refreshed the next level up sup-process node and it appeared. Still have to do testing to make sure it's working, but my final question is that I thought that the variable was passed into the sub-process as a Model Variable automatically when you click the "Pass as Reference" button -- if I'm not mistaken, this is what happened on the first sub-process. Why does the variable have to be manually added from the bottom up in this case?
  • Yes, you can do this by creating variable as parameter and then you need to pass its value to next process model by creating pv in all child process and setting the value from previous one.
  • Pass of reference will be used when the variable passed from parent process to sub process changes in sub process, it would be reflected in the parent process.