Hi
For each Row in Data table,i need to assign the index of that row that has been captured back to the row in for each Row, so as to perform some other arithmetic operations.Please advise.
Hi
For each Row in Data table,i need to assign the index of that row that has been captured back to the row in for each Row, so as to perform some other arithmetic operations.Please advise.
HI @amr07
Have a counter variable which starts from 0.
In the For Each Row activity, have the counter variable increment by 1. So in each iteration, it will contain the index of the row
Int32 Counter = 0
For Each Row - Item of DataTable
Begin
//Your Data table row processing
Counter = Counter + 1
End
Hope it helps
Thanks for the reply.I need the index assigned back to the row.so that when certain conditions meet i would like to tweak accordingly.
Here since the counter is an interger how can this be assigned to row which is of type system.data.datarow?please advise
Hi @amr07
You can do it like this. Check the sample workflow…
Here First I read a set of data from an excel file. Then I add a new column to the datatable to hold the index. Then in the For Each Row activity, I assign the row value to the new column.
I guess this is what you need
AddRowIndex.xaml (7.3 KB)
Let know whether this works out for you.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.