Skip to main content
Solved

Add data to dataset from an iterative loop


Forum|alt.badge.img+1

Hi everyone,

I have a loop set up that loops through records 50 at a time until the end of the day’s transactions. I would like to build a dataset of all records retrieved from each run of the loop to be exported to Excel. I thought about using a list but I cannot seem to find the right actions to append the data in within each iteration. Could someone give me some guidance or suggest a better way to attack this please?

TIA,

Steve

Best answer by jon.stueveapeople

Both @Aaron.Gleason and @Rajesh E have good options. The easiest way is to use the Log to File method to write to a CSV file. Then outside of your loop, you can read from the CSV file into a Table type Variable, then insert those records into your Master Spreadsheet.

there are many ways to do this type process, using CSV, Excel, Database, or an in-memory DataTable per Aaron’s suggestion.

View original
Did this topic help answer your question?

3 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+10
  • Automation Anywhere Team
  • 503 replies
  • May 13, 2024

Generally, a data table will work best for this. You can add as many columns and rows to the table as you need. You don’t need to pre-allocate the table -- it will dynamically grow as items are added. If you need the rows in a specific order, be careful with the Data Table: Add row action. I’ve seen people use it incorrectly and get the order of their rows backwards.


Forum|alt.badge.img+7
  • Navigator | Tier 3
  • 76 replies
  • May 20, 2024

Hi Steve,

 

You can utilize the log to file functionality where the data can be stored in comma separated values format or create a template of excel with the required fields that you want to insert the from the API Output.

 

Thanks,

Rajesh E


jon.stueveapeople
Automation Anywhere Team
Forum|alt.badge.img+7

Both @Aaron.Gleason and @Rajesh E have good options. The easiest way is to use the Log to File method to write to a CSV file. Then outside of your loop, you can read from the CSV file into a Table type Variable, then insert those records into your Master Spreadsheet.

there are many ways to do this type process, using CSV, Excel, Database, or an in-memory DataTable per Aaron’s suggestion.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings