How do I handle retry scope for each excel row

Hello

My automation: for each excel rows it opens a website and downloads something from there.

The problem is that sometimes there are errors I can’t fix.

How do I do that: if there is an error the automation will kill browser and try the same row again, but not to go back to first row but to try again with the same row?

@anon40731888

In for each row in data table use the retry scope and place all the activities in that so if the row gets failed also it will work again with the same row.

Regards

1 Like

Hi @anon40731888

Are you using Re-framework with queues.

Hi @anon40731888

  1. Read the Excel file and store the data in a DataTable.
  2. Set up a For Each Row loop to iterate through each row of the DataTable.
  3. Inside the loop, place the activities to open the website and download the desired content.
  4. Wrap the activities within a Try-Catch block to handle errors:
  • In the Try block, include the activities to open the website and download the content.
  • In the Catch block, handle the specific exception(s) that may occur.
  • Add actions to handle the error, such as logging the error and closing the browser.
  1. After catching the error, use a loop to retry the same row:
  • Set up a loop, such as a While loop, with a condition that checks if an error occurred.
  • Inside the loop, perform the necessary actions to retry the same row, such as closing the browser and reopening it.
  • Update any necessary variables or states to track the number of retries.
  • Exit the loop when the desired condition is met (e.g., successful download or reaching the maximum number of retries).

Hope it helps!!

I can’t I use studioX I need to switch to Studio but can’t right now so the retry scope is the only way for me

@anon40731888

By using retry scope it retries the specific action sometimes(as per the input given). Use try catch block for the action where the exception occurs, if is there any business exception occurs then it skips the current one and will continue to the next item.

Why do I need to store excel rows into data table?

If you put the entire activity in a retry scope without any conditions, then it will retry the given activities until no exception occurs. To avoid infinite retries, you can put a limit by assigning NumberOfRetries in the properties of retry scope

but inside the for each excel row activity no?

It depends on your implementation/ use case. If you want to retry for each row then inside the for each but if you want to retry a specific function then put those activities in the retry scope. Hope this helps. Cheers!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.