How to filter rows in DT for same value in two columns?

Hi everyone!
I have a question about filtering process.
I have an example excel and I want to get yellow marked rows inside of this DT.
example.xlsx (8.2 KB)

I use this formula but it doesnt work.

(From p in DT.Select() where( From q in DT.Select() where q(“Column4”).Equals(p(“Column4”)) and q(“Column5”).Equals(p(“Column5”)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

How to filter out yellow marked rows?

HI @ozgecatak

Have You tried with Filter DataTable activity

Check out the docs

Regards
Gokul

HI @ozgecatak

Your LINQ Expression is working good

Check out the XAML file

FilterDtgetRows.xaml (6.1 KB)

Regards
Gokul

1 Like

Hi @ozgecatak

It seems like your linq is working fine

Regards
Sudharsan

Hello @ozgecatak

Please share the screenshot of the error that you are getting as the linq is working as expected.

Thanks

Hi Rahul!

I got this error.

Assign: The source contains no DataRows.

But when I check my DT in watch panel, I show datarows.

Hi @ozgecatak ,

The Linq query used converts the Filtered rows according to the condition directly to a Datatable using .CopyToDatatable but in cases where the condition fails we do not have any filtered rows and hence we get the error as seen.

To handle that we already have a Tutorial Post on it, Do check it and let us know if you were able to make the necessary changes :

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