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 this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.