HI Team, this is a problem that im facing while running Do-While loop
robot is running the numbers for the first entry ‘Thrice’(not desired) whereas for others it is doing it once (which is the desired state)
the output now looks like this
the logic is as : i) row_count = dt1.Rows.Count
ii) For each row in dt1
iii) Do while : Assign Val = Val +1 (default value = 0)
iv) Add Data row
v) Close Do-While : Val<cint(row_count)
I think I know why it is running multiple times for the first entry and not for the rest…
See, first execution the variable Val starts from 0 as it enters the for each row and the do while loops. Then in the do while, it increments… but the problem is, when the do while loop is over, it goes right back up for the for each row loop to get the next row from the datatable. But this time, the val variable is not assigned to its default value which is 0. That’s one scenario…
The other scenario is, why do you want to use a do while loop inside the for each row? The for each row activity already loops until the end of the records and you can directly add each row to add data row activity without a do while loop… any specific reason you use it?
Male Sure row_count is a variable of type int32
And if so we don’t need to use cint atlast
If we want to add the current data to another excel after validation then we don’t need use a DO WHILE activity
Rather directly use ADD DATAROW activity and mention the input in ArrayRow property like this {variable1,variable2,…,.variablen}
and datatable as your datatable variable