I have read the data from Xls and put that into Data table . Now I have used for each row in data table function to enter data from data table in to the application. It is entering data but after data from all rows are entered Loop does not exit but it tries to enter data of first row again into the application.
I have cross checked the data in Data table by displaying it in a message box and it is showing same number of rows as there in Xls.
Can someone help on this.
Could you please upload workflow .
blocked by company network.
Sorry pal.Can’t say much looking into screen shot.Anyway you could do below steps to stop the looping.
- Check number of row by “datatable.Rows.Count.ToString.”
- then create a counter variable cnt and increase the count in every iteration (cnt=cnt+1)
- use if condition to check whether cnt =no.rows of datatable if true then use "Break" Activity to come out of For loop.
OK Thanks , I’ll try this
I have tried this, and it works. But what if I want to re-enter the loop on the next row?
If I break my loop will not continue to increment.
I am looping until I get a condition = true. If it happens I will break, write in Excel, and start from the beginning.
If false, it will continue to do some other code. It is too much code for me to put in “else”. And it is occuring several places in the code. So I need an easy way of skipping a line in Excel/row
instead of using Break, what else can I use to continue to next sequence when IF Condition satisfied?