SubProcess outputs

Certified Lead Developer

Hello,

can someone help with this issue.

I have a process model that retrieves data into  a variable defined as a multiple of CDT.

The variable is then passed as a parameter to a sub-process, and because it is a CDT and may change it is also defined in the sub-process outputs.

I can see multiple records being passed correctly to the sub-process but when the sub-Process ends, the output only has one record.

Both variables in the main process and sub process are of the same type and have been defined as multiple.

I can see in the process history of the sub-process that the CDT has two records, and this does not change and that the main model starts with two records and is changed to one after the call to the sub-process

Any ideas why data is being lost?

Many thanks

SimonJ

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to simonj3483

    There has to be something being done to the variable in the subprocess - I've tested something similar myself and it works fine, it even works enhancing the data without using the pass as reference option.

  • 0
    Certified Lead Developer
    in reply to Alex Boerescu

    Thankyou for the reply Alex, I think what has happened is the cdt was updated and one or more process models were not automatically updated. Gone into each of the models and deleted / recreated all the variables of that type. Republished the forms and it is all working as expected. 

  • I just wanted to add that passing a CDT by reference to a sub process does go against best practices, as when the CDT is updated the parent process and sub can then contain different versions of the CDT which in my experience, can cause the CDT to wipe it's data completely when a save is attempted, or other funky behavior.

    As you mention this is a short lived process, it may not be as big of concern here.  However I always recommend to persist the data to the DB prior to the sub process, then only pass the Unique ID to the sub, first step in the sub runs its own query to retrieve data from the DB to populate the CDT.

    Along with such, I build my sub processes to save data back to the DB before exiting, then the parent will refresh it's CDT PV via query against the DB after the sub is completed.