Merge/Append Two collections with Different Fields?

#1
Hi all,

i have a Question regarding Collections Two collections with same fields and one collection has an extra field , and trying to merge or append the field and create a new Collection.

Ex:
A Collection has 8 fields Which has 4 rows containing Data
B Collection has same 8 fields and it has extra 4 fields Which don't have any data
and am trying to merge or append this collection such a way all the data from A collection of 8 fields 4 row Data will append to B collection same 8 fields and leave those empty 4 Fields and Create this in to New Collection "C'


Note:i was Aware by using Utility Collection Manipulation merge or Append to Rows Collection we are able to partially achieve like for Merge Collection the two collections supposed to be different Fields and for Append to rows Collections we can append if it has same fields if it has extra fields it will fail and also i was aware by using Multi calculation stage we can achieve this, is there any way we can achieve By using other VBO or using Utility Collection Manipulation?
 

VJR

Well-Known Member
Staff member
#2
Hi harish17,

I believe this is how the structures of your collection are:

Collection A:
Field 1 | Field 2 | Field 3 | Field 4 | Field 5 | Field 6 | Field 7 | Field 8
Row 1
Row 2
Row 3
Row 4

Collection B:
Field 1 | Field 2 | Field 3 | Field 4 | Field 5 | Field 6 | Field 7 | Field 8 | Extra Field 1 | Extra Field 2 | Extra Field 3 | Extra Field 4
No rows

At first take a look at the Join Collection action in the new Collections Extended VBO and see if it can achieve what you are looking for. I do not have this VBO so cannot tell you more on that. But if you do not have the latest BP versions and cannot see the VBO then you can download it from the BP Portal.

To me the quickest and a no-code approach looks to be the below.
- Use 'Write Collection' and first write the Collection B to an Excel sheet. (This can be a temporary file and can be deleted later).

- Assuming you have written the Collection B in cell A1 of Sheet 1, now write the Collection A at the same place ie; cell A1 Sheet 1.
Your excel sheet would look like this
Field 1 | Field 2 | Field 3 | Field 4 | Field 5 | Field 6 | Field 7 | Field 8
Row 1
Row 2
Row 3
Row 4

- Now your Excel sheet should look like this
Field 1 | Field 2 | Field 3 | Field 4 | Field 5 | Field 6 | Field 7 | Field 8 | Extra Field 1 | Extra Field 2 | Extra Field 3 | Extra Field 4
Row 1
Row 2
Row 3
Row 4

- Use 'Get Worksheet as collection' on the above sheet which will get it as Collection C.

If you are unable to go by this approach then you might have to take the Code stage and interact directly with the rows of both the Collections.
 
#3
The quick way to do this is to create a master collection with named fields (all the field names in collection 1&2). After that use an append rows action to append both collections to the master collection.
 
#4
Hi Tolani

I assume You are Asking to use Append Row collection From Utility Manipulation Collection VBO? in that case it won't take if one of the collection has More Fields it supposed to have Same Fields. in my Case One of the collections has more Fields So By using the Append Row Action Wont Work.
 
#5
Hi VJR ,


Are you Referring VBO name is new Collection?, i think for collections it has only 2 VBO's one is utility Collection Manipulation and Other is Internal Business Object- Collection, Neither of this collections has Join Collection Action. and i was trying To Check VBO's in Blue prism Portal BUt i didn't see any Where Could please tell me the Path From Blue Prism Where i can download Couple of VBO's.?

I will Try Your second Suggestion By Using Excel .

Thanks
 

VJR

Well-Known Member
Staff member
#6
Hi VJR ,


Are you Referring VBO name is new Collection?, i think for collections it has only 2 VBO's one is utility Collection Manipulation and Other is Internal Business Object- Collection, Neither of this collections has Join Collection Action. and i was trying To Check VBO's in Blue prism Portal BUt i didn't see any Where Could please tell me the Path From Blue Prism Where i can download Couple of VBO's.?

I will Try Your second Suggestion By Using Excel .

Thanks
Yes its a new VBO in the newer versions. Refer the screenshot in the first post of the below link. On the other hand since I do not have the VBO I am unaware of its working and whether it will work in your scenario or not, but thought it could be easier for you to use a VBO in case it works.
https://www.rpaforum.net/threads/join-two-collections.8767/
The VBOs that are available for download are in the Products -> VBO section of the Blue Prism portal.
 
Top