While Loop w/ Counter

Hello,

I am having some issues with a while loop. I have a ForEach row loop inside the while loop with a counter. The counter works fine and increases as it goes through each loop (I used a dialog box to check).

The problem is, the while loop doesn’t break when the condition has been met. I have the condition of the while loop as “counter<26”. I need it to run through the loop 25 times, break run a few things then restart the loop again.

Thanks in advance!

The For Each Loop is going to go through all values within the datatable/array/list/etc… If you only want to iterate through the first 25 entries then you should use the counter as an index to reference the current entry in the datatable/array/list that you wish to process. At least that would be my guess as to what the issue is.

1 Like

First things first:

  • Break only goes out of the For Each and not the While
  • For Each already have built in index property
  • look into the scope of your counter variable
2 Likes

I used an IF statement that was nested under the ForEachRow with the condition as “counter<26”. So if its under 25 it does what I need it to and once it hits 26 it will reset the counter and run the process I needed it to and then obviously restarts.

1 Like

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