cancel
Showing results for 
Search instead for 
Did you mean: 

Collection in Item Data changing

Barendde_Villie
Level 3
Good day,  Can someone please help me understand how BP works in the background with regards to collections? I have a collection field inside of my Item Data which contains a few rows and fields. After I get next item, I enter a work step page. Before I do anything on that page, I set the collection from Item Data into working collection on that page using a calculation stage. This is to allow for better exception handling. Meaning, I want to process the working collection and only after I am done with the processing, I want to set the collection back into Item data. The reason for this is that I do not want to change the original data if I am not done with all the wok in that work step. But I realised that when I update the working collection (which is not a global data item) on that page, the collection within Item data is also updated. Can someone please explain why this happens? Is it some sort of memory efficiency mechanism of BP? So when I use the calculation stage to set the working collection it only 'points' to the collection in the Item Data? Thanks in advance.
4 REPLIES 4

Joshi_KumarA_V
Level 3
There must be something wrong with the way you are assigning back the data in the collection. Collections are more like list, you need to clone it. If not, they will update the copied list.  Attach your workflow to better understand and resolve the issue. 

Barendde_Villie
Level 3
Hi, I have come to believe it might be because the original Item Data is a Global Data Item. But it still does not make sense to me that the item data collection also updates while I loop through the local collection on the workstep page. I have created this dummy process with dummy data and notes for the support ticket I logged with BP Support (still awaiting a reply form support). See the attached screenshots to illustrate my question. I hope the image is clear enough. Important Note: I do not send the Collection within Item data as an input into the Workstep Page. I use the first calculation stage to set the Item data collection in the working collection on the Workstep page. But even if I did this I get the same result.

AndreyKudinov
Level 10
Show screenshots of loop properties (which collection) and calc stages.. You are accessing global item data most likely.

Barendde_Villie
Level 3
BP support helped me resolve this issue. This behaviour is expected with BP because when a nested collection is passed to its own collection, a reference is maintained. So essentially the collection you pass it to only 'points' to the original nested collection. And yes, because the original collection containing the nested collection is a global item, it is also appended when you append the local collection. This behaviour can be disabled. Support sent me this link which explains how:  : https://help.blueprism.com/1149778522 Kind regards