Next/previous row item in data table

Hey @prabirs

You can follow below steps:

  1. First find the value from datatable that particular column value by using "Datarow[ ] results = Datatable.Select(“[ColB]=‘your value’”)
  2. The above step will return “Datarow[ ]
  3. Iterate with Datarow[ ] by using For-each activity with Type Argument=System.Data.Datarow.
  4. Well assuming you have distinct records with values then just find the row index
    "Int value_row_index =yourdatatable.Rows.Indexof(results(0))
  5. Then you can get Next Row’s Column value like this
    String next_col_value = yourdatatable.Rows((value_row_index+1))(“your_col_name”)
  6. Similarly you can find previous row’s Column value like this
    String prev_col_value = yourdatatable.Rows((value_row_index-1))(“your_col_name”)
  7. now perform your comparison steps with above results.

Regards…!!
Aksh

8 Likes