Need help to filter data table

Hello Team,
Could you please help me what needs to be done to filter filter the DT and get the earliest time stamp shown in the picture.

Thanks

Hello @Venu_V

Try with:

Assign date_Earliest = dt_Datatable.AsEnumerable().Select(Function(row) DateTime.ParseExact(row("ConnectionUptime").ToString(), "yyyy-MM-dd HH:mm:ss", New System.Globalization.CultureInfo("da-DK"))).Min()

Regards
Soren

thank you. I will try this solution now

@Venu_V
I can see that I forgot my danish CultureInfo - just adapt the one relevant for you :slight_smile:

And I have changed to correct format

yyyy-MM-dd HH:mm:ss

Regards
Soren

not working :frowning: it says value of date cant be converted to data table

please help . i am getting an error

@Venu_V

is your data in excel if yes then you can sort it based on the timestamp column and pick the first row. if not then then use something like

DT.AsEnumerable().OrderBy(Function(row) row.Field(Of DateTime)("ConneectionUptime")).FirstorDefault()

this will give you the timestamp use it to find the matching row in the dt and pick your data from there

the linq outputs a DateTime not datatable change the variable type

if my data is in excel how i can sort it , please explain

there is sort range activity

The variable date_Earliest should be of type DateTime.

  1. Use activity “Read Range Workbook” on your Excel file (save as dt_Datatable)
  2. Create DateTime variable date_Earliest
  3. Use the activity “Assign” with the content I initially wrote

Then you have the earliest date present in the Excel file saved as a DateTime variable.

Regards
Soren