You have to login in order to post a reply to this topic.

2 replies [Last post]
cliftonbazaar
User offline. Last seen 1 year 19 weeks ago. Offline
Joined: 04/27/2010
Posts: 6

Hi,

First of all I set up a loop that reset if a particular incident happened.

Loop 0 to 25 by increment of 1 (Make the variable %loop% in this example)
  Do what I need to do
  BUT if this happens then
     Set variable %loop% to 0  //This resets the loop (theoretically)
End Loop

This doesn't work, the variable %loop% is set to 0 but then changes straight back when the loop ends i.e if it was in the 23rd loop then %loop% goes to 0 then back to 24.

D.M.Altizer
User offline. Last seen 1 year 11 weeks ago. Offline
Joined: 01/12/2010
Posts: 204
Re: Loop with condition

Hello,

The approach that you have chosen does not seem to be the correct one. The index that is being used by the "Loop" action should not and cannot be changed (as far as I know). For your specific needs, the appropriate action to be used is the "Loop Condition" action. Let me explain how your job should look like:

- Set Variable %LoopIndex% = 0
- Loop Condition %LoopIndex% <= 25
  - Do what you need to do
  - Increase Variable %LoopIndex% by 1
  - If this happens
    - Set Variable %LoopIndex% = 0
  - End If
- End Loop

This way, you will be able to change the %LoopIndex% variable's value according to your needs and check for its value at the end of the loop. This practically means that if the index reaches the value 26, the loop will end properly.

__________________

==Dedicated Automation Solutions==

__________________

==Dedicated Automation Solutions==

cliftonbazaar
User offline. Last seen 1 year 19 weeks ago. Offline
Joined: 04/27/2010
Posts: 6
Re: Loop with condition

Thanks for that; have upgraded the program and that works :)