Linq to Filter datatable with two rows as header values

Hi all,

The input file is below

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

The required output is as below

Condition is to filter rows with Yes values in the Actual column
Any idea on how to achieve this?

Regards!

Hey @Ray_Sha1

Does this mean, you want to filter rows which has values in all the 4 columns ?

Thanks
#nK

Hi,

Filter needs to be done based on the actual column, with values yes in it.

Thanks!

Okay perfect. So Filter Data Table should do the job. Did you try that please ?

Duplicate : Linq to filter data - #18 by Gokul001

Hi @Ray_Sha1

Try this LINQ

(
    From r in dt_Data.AsEnumerable()
    Where dt_Data.Rows.IndexOf(r).Equals(0) Or r("Actual").ToString.Trim.ToUpper.Equals("YES")
).CopyToDataTable
1 Like

Hey @kumar.varun2
This works correctly.

Thanks!

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