Get last row data


Dt


Hi all, I have scraped some data from a web page into a data table and want to check the last row for current date. How can I get the last row? I’ve tried the following methods.
Please advise
Regards
Anived

Hi,

Your approach seems good. Can you share your problem in detail?

Regards,

I tried using both var.AsEnumerable.last() and var.rows(var.rows.count-1) however when I am using write line to see output I’m getting “System.data.datarow” and not the third row of the table. Since I am not getting the desired row, I cannot check for current date or perform any other actions on it.

Hi,

If you want to check content of the last row of datatable, can you try the following expression, for now?

String.Join(",", dt.AsEnumerable().Last().ItemArray)

note : dt is datatable variable.

Regards,

1 Like

ew_DT = DT_input.asenumerable.reverse().take(1).copytodatatable

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.