Linq to filter data

Hi,

I have a datatable which looks like the image below.

Input:

I want to filter the datatable based column Actual where the values is yes
Output:

Is it possible?

Thanks!

Hi @Ray_Sha1 ,

Use filter datatable activity and use the below condition,
image

Hi @Ray_Sha1

How about this expression ?

Dt.AsEnumerable().Where(Function(w) r("Actual").Tostring = "Yes").CopyToDataTable

Regards
Gokul

Hi,

This is giving me blank datatable.

Thanks!

@Ray_Sha1
Use assign activity
Left side put dataTable
On right side put this one

DT.AsEnumerable()
.Where(r => r.Field(“cloumn name”) == value)
.CopyToDataTable();

@Ray_Sha1
I think when you are reading data table it is saving Actual column as ColD…please verify by printing datatable after reading from excel. You will find out where is problem.

Hi @Ray_Sha1

Try this one,
dt_ExcelTable.AsEnumerable().Where(Function (r) Not r(“Actual”).ToString.Trim.Equals(“Yes”)). CopyToDataTable

Regards

@Ray_Sha1 please check datable after reading, how its look like. I have been faced this kind of issue already

Hi,
In The required solution in need the second row as well.
The solution work’s fine, but the second row is getting eliminated.

@Ray_Sha1 can you show me for more clarity

@Gokul001 the solution is works fine.
But the input excel after reading is as shown in below image:

The

Output required is

So After apply query its also taking Actual Empty values

That you get the correct Output using Linq @Ray_Sha1

But i need the second row, in the solution provided by you, second row is skipped

No. The query works fine.
But i need the second row…

@Ray_Sha1 what is your out after runing query… I am confuse little bit about output

The input file is below

after reading the input file, the datatable is as below:

The required output is as below

Any idea?

Hi @Ray_Sha1

Have a look on the XAML file

LinqFilter.xaml (9.5 KB)

Output

image

Regards
Gokul

@Ray_Sha1 can you please show me filter activity which you are using