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
Could you provide a screenshot of the mapping on the output variables from the subprocess task?
Hello simonj546 ,
Can you just check if you have mapped all the required output nodes inside your sub-process and also can you check if you have given the check box for multiple records in your all write records nodes.
Hello Konduru, all process variables are multiple. I can see in the runtime process history that 2 records are retrieved and passed into the sub process, that the sub process does not delete any data and and that the calling process is updated with a single record.
Have you tried passing it as a reference? Since it's a sync process it wouldn't get updated anywhere else in the process while the subprocess runs.
Hello Alex,
passing by reference works which solves the immediate problem, and as it is a short lived process should not cause too many problems. I would still like to know why the output is not working as expected.
Thanks
Simon
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.
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.