cancel
Showing results for 
Search instead for 
Did you mean: 

How to format nested collection in Blue Prism

PatrykLiberski
Level 4

Hello, 
I am retrieving some information with Blue Prism from one API, and I receive a collection as the output. The problem is that I do not want my collection to look like this. I want to receive one collection with one row where I will have all of the employees listed, not 1 employee per 1 collection. Now I'm getting a collection with many nested collections, and each of them has 1 row. I tried to use a loop with utility collection manipulation - Copy rows and also Collections - Copy Rows, but it did not work. Could anyone tell me, how can I format my collection to get only 1 collection with all of the information in it, please?

https://imgur.com/a/NhCjf5m
Best regards



------------------------------
Patryk
------------------------------
3 REPLIES 3

11235813sk
Level 3
Hi Patryk

If you are on Blueprism 6.4 + , you can use the Webservice option in settings to get the response and use the JSON Path to extract every employee as a 1 employee per row.
Try using JSON path.

Thanks


------------------------------
sanjeev rout
Advanced App Engineering Specialist
Accenture UK
Europe/London
------------------------------

VivekGoel
Level 10
If using API-->
How about getting the response in a JSON String and then use the JSON de-Serialization as per your need?

------------------------------
Vivek Goel
RPA Architect
Asia/Singapore
https://www.rpatools.com/
"If you like this post, please press the "Recommend" Button.
------------------------------

DaveMorris
Level 14
This is kind of an annoying thing to do deal with. If you have data that is nested several levels deep and you're not always sure what level the data will be at, then I don't think my suggestion is the way to go. But if you know it will always be Level 1 will be a single Collection field where it looks like 'Row 1 of 1' in every row, then you can loop through that and extract it into a normal collection of data.

You'd loop through with Loop stages on the 0_Results collection, and then use some method to add the row to a new collection like [0_Results.JSON:Array] in a calc stage or I suppose you could append rows to collection (Collection manip VBO).

It sounds like you were on the right track, but copy rows wouldn't be the way to go because it overwrites the data in the output collection. Use the Append action in the Collection Manipulation VBO.

You could certain go the route that others suggested and convert to JSON instead. That would likely run much faster than looping through all the rows to extract the nested collections. So it's really up to your preference.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA