Hi, I would like the robot in the datatable to filter all days to a specific date, e.g. filter all days from today until the end of September - format daty: 2024-09-30 (YYYY-MM-DD). Thank You ![]()
Hi @sullivanne
Try this
filteredDT = dt.AsEnumerable().Where(Function(row) DateTime.Parse(row("DateColumn").ToString()) >= DateTime.Today AndAlso DateTime.Parse(row("DateColumn").ToString()) <= New DateTime(2024, 9, 30)).CopyToDataTable()
Regards,
Hi @sullivanne
You can use the LINQ Expression to filter the data with the required condition,
- Assign -> Output_DT = DT.AsEnumerable.Where(Function(X) CDate(X("Columnname").ToString)>=DateTime.Now AndAlso CDate(X("Columnname").ToString)<=DateTime.Now.AddMonths(1).AddDays(-1)).CopyToDataTable()
Hope it helps!!
give a try at
Assign Activity
endDate | DataType: DateTime = #09/30/2024#
Assign Activity
dtFiltered =
(From d in YourDataTableVar.AsEnumerable
Let dp = DateTime.ParseExact(d("yourColName").toString.Trim, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture).Date
Where dp >= Now.Date AndAlso dp <= endDate.Date
Select r =d).CopyToDataTable
Handling empty Results:
[FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum
Analysis when Parseformat is to adapt:
[FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum
Hie @sullivanne
use read range to read the data
use for each row to iterate to loop through
use assign activity and in the assign save that column value which hold the date data
after that you can add this query which convert your date in your desired result
1- step
your input date as example -
Activity you need –

to store the date column in variable

to convert date format in your desired format
Hope you get the point .and understand the concept
cheers Happy Automation
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

