Iterating through a list of UI Elements in a browser and save all the data

Hello,

I am using a bot to populate a Master Data Table with Client ID, and other 11 pieces of information pulled from a system via browser.

Input: A list of unique Client IDs sourced from an Excel document.

The bot iterates through the list, navigating a browser-based internal system to search for each client ID and retrieve associated data (Account Name plus other 11 columns of client data).

Current Issue: One-to-Many Relationship
A single Client ID often yields multiple Account Names (e.g. Client ID: “1234” returns both ‘Jane Doe’ and ‘Jane Doe’s Bakery’)

The current loop (For Each UI Element with Get Text) successfully identifies all the accounts on the screen. However when the bot attempts to save the data it only retains the last account name found for that Client ID as it overwrites the previous results.

I need a final Data Table that stacks the results duplicating the Client ID for every associated Account Name and its corresponding client data columns. I’m unsure if my current process logic is correct for achieving this stacking output:

Input

Client ID
1234
4432

Desired output:

|Client ID|Acc Name |Address |Last purchase |Item ID|
|1234 |Jane Doe |1234 Main St |01/01/2025 |43568|
|1234 |Jane Doe’s Bakery |15th East Street |03/25/2022 |4302885|
|1234 |Jane Doe’s Warehouse |15th East Street |03/25/2022 |436943|
|4432 |John Smith |11 West Street |10/10/2020 |123|

Hi @juan.avila

Just check all steps- use For Each Row to loop through Client IDs. Inside that, use For Each UI Element to extract all account data. For each account, use Add Data Row to insert a new row into the Master DataTable. This keeps all results stacked and avoids overwriting. Finally, write the DataTable to Excel.

Happy Automation

1 Like

hi, @juan.avila You can fix this by storing each extracted row in a temporary DataTable and then appending it to a master DataTable instead of overwriting it.

Here’s a simple approach: 1. Create a DataTable (dt_Master) with all required columns.
2.Inside the loop (for each account found):
* Use Build Data Table or Add Data Row to create a new row with ClientID, AccountName, and other details*.*
* Use Merge Data Table or Add Data Row to add it into dt_Master.
3.After the loop finishes, write dt_Master to Excel.

This way, all accounts related to the same Client ID will be stacked correctly instead of replacing each other.