Hi @rag
Welcome to uipath community
Great
- to get the current row i hope you are using for each row loop with datatable as input and getting the row index, but i would like to make a small suggestion with the way we get the currentindex, a integer variable
it should be like this
currentindex = dt.Rows.IndexOf(row)
actually this gives the index of the current row which is getting iterated from the for each row loop in dt, the table that you pass
if you get like this
currentindex = dt.Rows.IndexOf(row) + 2
it adds up the row index with plus 2 from the current
say for example we are in row 1 now, we want the row 1 and row 0, the previous one
if we do with what mentioned by you see,
currentindex = dt.Rows.indexof(row)+2
currentindex = 1 + 2
currentindex = 3
then with previous formula you have
previousindex = currenindex -1
previousindex = 3 - 1
previousindex = 2 ,we are getting next row…thats why
so use
currentindex = dt.Rows.IndexOf(row)
thats all you were almost done
Hope this would help and kindly try this and let know
Cheers @rag