Hi. I’m currently working on automating a use case wherein I need to capture a set of data from an excel file (newDT), but every time I loop (in my for each row activity - see Figure 1.B below), it just captures the first row’s data, so basically it loops twice (because there’s 2 rows on my excel file) but on the second loop I want it to capture the second row (it still captures the first row’s details on the second loop)
So here’s what I have so far;
@UiP_Mc
Buddy the reason why you get this error when we are iterating a datatable with for each row loop, to get the value of each row in a particular column we must mention the foreach row loop variable and not the datatable(unless we need in specific)
So as you have mentioned as newDT.Rows(0)(“Item_Quantity”).ToString, though you iterate through each row, it will only take the value of first row (index 0) as per this.
Instead if you have mention as row(for each row loop variable) which gives us differnt value as it iterates through each row we wont get the repeatd value as you get now.