Why does "Do While" activity only work for the first pass through of the activity body

I have created a “Do While” Activity to complete a laundry list of activities for each row in a datatable. The first pass through of robots works fine, but when the bot goes to the next row and completes the same work that it did for the first row, its doesn’t pick up the condition and runs through entire datatable.

Am I using the wrong condition concatenation?

strMasterAccountNumber is dynamic, each time you pass through the “Do While” you get a new number, I need the bot to read the Data Table, and when it find the strMasterAccountNumber that is equal to it, pull the data located on “B+ rowCounter.ToString”

I would recommend using a Read Range and using a For each on the table so you don’t need to check if you are at the bottom of the data, et cetera.

However, if you are using this Do While method, verify that your rowCounter variable is in an outer scope, because if it is decleared in the Sequence scope that it is inside, it will get re-initialized back to 0 each time it loops… basically, make the rowCounter global to the Do While loop.

Regards.

Agree with @ClaytonM, Also, do write link on both variables you are checking as last entry in sequence and see what values you are getting.

DoWhile will perform action and then check the condition. I have a feeling that condition is met and it exists the loop.

The rowCounter scope was global when the bot was run - I will the Read Range/For Each Method

@Kemal I used a message box to show the variable as a string. I would get the right variable and the condition should have been met, but it still looped through the “Do While”

@ClaytonM How do I incorporate a Condition in the For Each activity

So what were the output for cbsCellValue and strMasterAcctNumber?

They’re dynamic, but for the first pass through, when cbsCellValue = 414-0001-4180 it’s supposed to take the data to the right of that cell i.e. “C” + rowCount.ToString.

For the second pass through, when cbsCellValue = 431-0009-0592 the condition is met, but the bot still goes through the loop and doesn’t recognize this.

I’ve used the message box to make sure that I’m getting the right now, and I am