Hi
How to get last item that is numeric in datatable column ?
thanks
Hi
How to get last item that is numeric in datatable column ?
thanks
Hi @Suastrian_Dika ,
To retrieve last record in the column
dt.Select("Column0<>''")(dt.Select("Column0<>''").Length-1)("Column0")
Regards,
Arivu
Hi,
How about the following expression?
dt.AsEnumerable.Where(Function(r) Double.TryParse(r(0).ToString, new double)).Last().Item(0).ToString
Regards,
Hi @Suastrian_Dika ,
Assuming you have read the Data in the Excel sheet as a Datatable, say DT
. Then we can get the Last numeric value using the below Expression :
DT.AsEnumerable.Where(Function(x)x("YourColumnName").ToString.IsNumeric).Select(Function(x)x("YourColumnName").ToString).LastOrDefault
If there is no numeric value at all, it returns a null
value.
Thanks @supermanPunch
Thanks @Yoichi
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.