Getting the values in the current row and the next row in Datatable

hello,

can anybody help me understand how i can get the values from the current row(first column) and the next row(first column) from a Datatable variable?

thank you in advance

Hi,

If index of current row is 0, the following works.

dt.Rows(0).Item(0)

Item of the next row :

dt.Rows(1).Item(0)

Do you mean in case of For Each Row activity?

Regards,

1 Like

@Lior_Ben_Naim,

Can you please try to follow as below?

image

yes, in a for each row in data table i want to check each row and compare it to the next row

Hi,

Hope the following helps you.

Note: We need to consider to how handle the last row.

Regards,

1 Like

thank you it works!
but, i can’t figure out why i need to write CurrentRow.item(0) instead of CurrentRow(0)?

is this because we are handling values and the indexes?

Hi,

CurrentRow.item(0) and CurrentRow(0) both will work. If we use indexer for DataRow instance (like CurrentRow(0)) , it returns same as “DataRow.Item(idx)” property.

Regards,