How to filter 2 columns(one column is date type, another is string) at a time in a data table?

Hi All,

Can someone help in filtering data table with filter … I was unable to delete using filter .

I want to Remove rows when Status column is 64 and Created on is Current date-1(format 05/15/2023 00:00:00).

Date format is (05/15/2023 00:00:00)

Please find below attached excel for the same
Test2.xlsx (9.1 KB)

@ppr @Anil_G

Hi @Mandava_Naresh

You can either use “filter data table” or below Linq code to achieve the same.

(
From rows In Input_DT
Where Not (rows("Status").tostring="2" And rows("Status").tostring=Now.AddDays(-1).ToString(“MM/dd/yyyy 00:00:00”))
Select rows
	).CopyToDatatable

Let me know if you have any doubts on the same.

Regards,
Ashutosh Gupta

@Mandava_Naresh
As described in the FirstAid, Values from Excel are not mandatory the same within the datatable. So just analysis it:
:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum

Once this is cleared, then decide if a filter datatable, a DataTable.Select or a LINQ is better matching

1 Like

@Mandava_Naresh

As you need directly on excel, You can use filter and Delete rows activity from Excel activities

Flow

output

File
BlankProcess - Copy.zip (18.7 KB)

cheers

1 Like

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