cancel
Showing results for 
Search instead for 
Did you mean: 

#BPTechTips How to quickly copy collections ?

HarshitRawat
Level 8
Looking to make a copy of a collection  and searching the Actions in Collection -Manipulation ?
There is a simple way to do that without using any VBO

Just use the calc stage to copy values from one collection to other collection
25153.jpg


------------------------------
Harshit Rawat
Senior RPA Consultant
------------------------------
4 REPLIES 4

NafizZainal
Level 4
Hi @Harshit Rawat

Does this only works for collection with same number of column or can be used even with different number of columns? If not, how to copy certain column in a collection into another collection?

Thanks​

------------------------------
Nafiz Zainal
------------------------------

Hi Nafiz,

The method described merely creates an exact copy of the original collection. It copies all rows, there is no option to copy part of the collection. Of course, there are already VBO's and actions to copy only part of a collection, but the method described by Harshit does not do that.

If you take the time to test Harshit's nice idea, you'll find that if the ToCollection is undefined, it will get all fields and content from the FromCollection. If the ToCollection already has fields, these must be an exact match to the FromCollection fields, otherwise it will throw an exception.


------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

Hi Paul,

Can you tell me which VBO's that can copy a particular column from one collection to a particular column from another collection? I still can't find the solution for this.

Thanks

------------------------------
Nafiz Zainal
------------------------------

Hi Nafiz

I tried Harshit's idea on one column, but that did not work.

Fastest I could find is to copy the collection using the fast copy above, then remove the columns you don't need with action 'Delete Column' from object 'Utility - Collection Manipulation Extension'.

Alternatively, you could loop through your FromCollection while adding whatever data you need to the ToCollection. This would be a row-by-row operation and therefore perhaps not so fast if you have large collections.

------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)