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:
Remove rows when Status column is 64 and Created on is Current date-1(format 05/15/2023 00:00:00).

1 Like

you can use filter data table

Hi @Sushmitha_G1 ,

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

1 Like

Hi @Sushmitha_G1 ,

Welcome to the Community!

First way is to use the Filter Data Table Activity: Where you can pass the column name as “Status” = “64” AND “Created On” = Now.AddDays(-1).ToString(“MM/dd/yyyy”) OR “Created On” = Now.AddDays(-1).ToString(“MM/dd/yyyy 00:00:00”)

Second way is: FilteredRecords= RecordsDt.AsEnumerable.Where(Function(r) conditions using and/or).CopyToDataTable

@Sushmitha_G1

Welcome to the community

Its the same requirement…attached a file as well please check

Cheers

Hi Ashutosh,
I tried this and it worked. Thanks much.

1 Like

Thankyou Aditya.
I tried first way before posting here. but it didn’t work.

1 Like

Thankyou Anil.

1 Like

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