I have a bot that runs a for each loop <=5 then breaks out of the loop and has to return back into the loop to continue process at row 6. I am testing a theory and need to know if this is possible?
So I get the row count out of the dt
I begin a for each
Pull some data out of the dt (a number value)
I have an assign = dt_verity.Rows.IndexOf(row)
then an if condition of dt_verity.Rows.IndexOf(row) <=5
This process runs and breaks out of the activity but I am not sure how to get this process to return back into the for each at row 6?
maybe restarting a loop can better done with the for each activity | typeargument: datarow
values: dt_verify.AsEnumerable.Skip(yourSkipVar)
skipVar | int32 - 0 on begin, later e.g. 5 to ommit the first 5 rows
I looked at this skip variable earlier. What I want to do and maybe I wasn’t clear is run the 1st 5 rows of data, process them and breakout and come back into the process at row 6. My reason is I am having issue with a site that runs out of memory so I have to run a process for a certain number and then exit the process to reboot the application and start clean where it left off?
Please check if below logic will work for you or not.
For each row in dtInput
Navigate and extract data from site
counter = counter +1
if counter > 5 then
invoke xaml > cleanup xaml (this utility will close the app and clear the cache and login again)
end if
Next row
Try using the mod function. Mod returns the remainder when dividing. So rowIndex mod 5 = 0 will be true for every multiple of 5, because 5/5 = 1 with 0 remainder, 10/5 = 2 with zero remainder, etc. That way you can perform certain activities every 5th row.
Put you For Each inside a Do Loop. for example.
LoopCount = Quotient of number of items in for each/5
Index = 0
Do for 0 To LoopCount
For Each CurrentIndex to Current index + 5 activity
Index = Index+1
EndDo