cancel
Showing results for 
Search instead for 
Did you mean: 

Adding new row of Data to Collection

AndrewMiller
Level 2
Hi All,

I am just learning and trying various things out, and this is not part of a larger project. I am trying to take a single row of data and append that to an existing collection. 

The following is an overview:

  • I get data using the Webservice Rest Action and put that into a collection. The result is a nested collection.
  • Then I use a Calculation stage to get the row data and store the result into a separate collection that only contains that row.
  • Now I am trying to take that one row of data and build a collection that is not nested and will contain all the rows of the nested collection. I can't seem to get the new collection to build without overwriting itself with the newest data.

I tried the following:

  • Loop stage that loops over the nested collection 
  • Get the current row of data 
  • Add a new row to another collection
  • Add data to that new row 
  • I have also tried adjusting the process and replacing the Add row action with Append Rows to Collection. 

I know I must be missing something simple, and if anyone can point me in the correct direction, it will be greatly appreciated because I am sure at some point I will want to append separate rows of data to a collection to build a new data set.  

Thanks, Drew

20610.png
20611.png
20612.png
20613.png


------------------------------
Andrew Miller
------------------------------
1 REPLY 1

EgorVavilov
Level 2
Hi, Andrew
Your efforts are highly appreciated! Remember that only patience and hard work will lead you to desirable expertise.

Let's dig into your issue.
1. Loop through "dataJson" collection.
2. On each iteration save current row of "dataJson" collection to temp collection "row".
3. Next step depends on how many rows of data do you have in "row" collection. I suggest you to use Loop stage to loop through "row" collection. It will help you to handle multiple rows in "row" collection and also be applicable for handle single row collection.
4. Now we actually have access to data in row of "row" collection. So we should add row to "Combined Collection" collection. And use Multiple Calculation stage to copy data from each field of current row in "row" collection to corresponding fields of "Combined Collection" collection.

Hope it helps!


------------------------------
Egor
RPA Developer
Ernst & Young
Europe/Minsk
------------------------------