I am trying to filter this excel file or datatable using LINQ and paste it on another sheet (Sheet2) where the Occupation must be Enforcer and Architect only and the Code Number must be blank or null.
I am trying to use this script but it shows an error: datatable.AsEnumerable.Where(Function(row) (row(“Occupation”).ToString.Equals(“Architect”) OR row(“Occupation”).ToString.Equals(“Enforcer”)) AndAlso row.IsNull(“Code Number”)).CopyToDataTable
May I know how can I solve this? Thank you so much.
filters the datatable based on the conditions provided (Occupation is “Architect” or “Enforcer”, and Code Number is null or blank). It also handles the case where the filter results might be empty by using datatable.Clone() to create an empty DataTable with the same structure