How to save the result variable into a new variable after "For Each" loop?

I am trying to get the response time from a dynamic table. I have to check the value every 3 minutes for a total of 5 times and for every run, I want to write the value to a text file.

Output example:
Response time for loop 1:
Response time for loop 2:
and so on…

Thank you for your help

Hi @aditi.sharma

You can declare 2 int variables countRun and TotalRuns
Use a while loop countRun<TotalRuns
perform Tasks
delay 00:03:00
end loop

Assuming that the Response Time is being read from some place and then inserted in your text file.

If you wanna use it on a For Each loop use expression Enumerable.Range(0,5)


Here’s an example workflow to achieve this:

  1. Initialize variables: Create two variables, loopCount (Integer) and responseTime (String), and set loopCount to 1.
  2. Start the loop: Use a “While” loop with the condition loopCount <= 5.
  3. Get the response time: Place the activities to retrieve the response time from the dynamic table or web page inside the loop.
  4. Write to text file: Use the “Append Line” activity to write the response time to a text file. Set the output text to "Response time for loop " + loopCount.ToString() + ": " + responseTime.
  5. Increment the loop count: Use an “Assign” activity to increment the loopCount variable by 1: loopCount = loopCount + 1.
  6. Add a delay: Use the “Delay” activity to wait for 3 minutes (180,000 milliseconds).