cancel
Showing results for 
Search instead for 
Did you mean: 

How to read values from nested collection?

Chiranjit_Ghosh
Level 3
Hi, I have read values from a Json code to collection using "Utility:Json" VBO. The Collection generated is a nested collection. When I am trying to retrieve the values from that collection, I am able to read only the first row . If I use the Loop, even then the result is same and the loop is executing once. ---------------So ,if anyone having the solution of that problem , please help me.
4 REPLIES 4

ShreyansNahar
Level 5
You need to run 2 loops for retrieving the data in nested collection. For example, the main collection is ""Emp details"" with the structure as: 1st column- EmpID (Text), 2nd column- Data (Collection). You need to first loop on ""Emp details"" and within that loop need to loop on ""Data"" to get each row at a time and use it for manipulation.

Hi Shreyans, Thanks for your reply. I have already tried in that way. But in this, I have to set the collection manually for each loop. If I take your example, For First loop I have to set the collection as ""Emp Details"", in second loop the collection name will be ""Emp Details.Data"" and so on. But if ""Emp Details"" having 100 or 500 collections inside it then what I do? So to make the process dynamic, first I need to check if the current collection having any internal collection or not and if it is so then it generates its path. And the path will be the next input collection for the next loop. So if there is any way to check these conditions or you have any simpler way to do it, the please let me know.

ShreyansNahar
Level 5
So, you mean to say that the name of your collection is dynamic? Is it the same for the internal collection? If the names are fixed, you can go ahead with the suggested method. If not, then we need to look out on how we can process that.

For the fixed name I am able to read, but I want to do it in a dynamic way where collection names will not be the same. As I said I was reading values from Json code, so the process should able to run with any type of Json code having any number of internal collections with any name.