cancel
Showing results for 
Search instead for 
Did you mean: 

duplicating a collection and changing its name dynamically

AviadBen_Zaquen
Level 2
Hi all ! I have an Agent Details collection, I'm running a loop on a Countries collection, the aim is create four new copies of the collection with the country respective names, so by the end of the process I need to have four collections: 'Agent Details-USA', 'Agent Details-Germany', 'Agent Details-France', 'Agent Details-Spain'. I tried adding various different collection manipulation objects but to no avail. Many thanks

14520.png

------------------------------
Aviad Ben Zaquen
------------------------------
3 REPLIES 3

Hi Aviad,

If am correctly understanding you are having Agent Details collection where details for each countries are available and you also must be having a column in that collection to identify the correct countries as well. You want to loop over Country collection and on the basis of the current country field you want to dynamically create different collections.

Here, there are firstly few things to note. You can't dynamically create a Collection stage during runtime. What I mean if it is always fixed that there are going to be always 'X' countries, let say for example 3 countries you can create three blank collections with the same name. But I think that is not fixed in your case. If that is the case, I can suggest you two ways.

First Way:

NOTE: Keep the below steps within the Loop stages of the Country collection.

- Loop over country collection and get the current country field.
- Use a 'Filter Collection' action and write the query to get the rows from Agent Details with respect to the current country field and store that result in a temporary collection stage.
- You can have a collection called as 'Final Collection' let say with two fields, namely, 'Country' of Text type and 'Collection Data' of Collection type. Just add a row to that collection using 'Add Row' action and then using a Calculation stage set up the current country for the loop over country collection as the value of the Final Collection.Country and the temp collection as the value of Final Collection.Collection Data

This way you will end up with one collection having one column indicating the country and the other one indicating a nested collection with agent details for that country.

Second Way:

- Loop over country collection and get the current country field.

NOTE: Keep the below steps within the Loop stages of the Country collection.

- Use a 'Filter Collection' action and write the query to get the rows from Agent Details with respect to the current country field and store that result in a temporary collection stage.
- Create a work queue to store the country wise details and you can keep the key as the 'Country'  column name of your temporary collection. Now you can simply use the 'Add to Queue' action and add the temporary collection to the queue



This way you will end up with a work queue having key name indicating the country and the agent details for that country can be retrieved easily using 'Get Next Item' from the work queue later in your process.


Let me know if that helps.

------------------------------
Regards,
Devneet Mohanty
Intelligent Automation Consultant
Blueprism 6x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com
------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------

John__Carter
Staff
Staff
How about a nested collection with a text field called Country and a collection field called Agents? Eg

USA
   - Donald
   - Joe
Germany
   - Angela
   - Olaf

------------------------------
John Carter
Professional Services
Blue Prism
------------------------------

Hi Aviad

If are looking for a code stage that will either create a collection or rename a collection I dont think there is a way to do this as you need to have a defined collection to output to with a name preset. You may be best to try @devneetmohanty07 and @John Carter suggestions as these should be good alternatives.

​​

------------------------------
Michael ONeil
Technical Lead developer
Everis Consultancy
Europe/London
------------------------------