Guhananth S

Guhananth S

  • NA
  • 57
  • 0

linq to filter records

May 8 2020 11:57 AM
Hi,
In excel i have read and  created data table  with columns and rows  as shown 
 
Explore value Insights value Explore Aggregator Dataset
Tickets # Tickets COUNT  
[Ticket Status - Unsorted] # Tickets COUNT  
 
so i want to get  [Ticket Status - Unsorted] and store in variable
 
I tried like this
var dataRow = from customer in dt.AsEnumerable()
where customer.Field<string>("Insights value") ==' # Tickets'
select new
{
strInsightsvalue = customer.Field<string>("Insights value"),
strExplorerValue = customer.Field<string>("Explore value"),
strExploreAggregate = customer.Field<string>("Explore Aggregator")
};
it show dataRow=null
or i tried below one
var dataRow = dt.AsEnumerable().Where(x => x.Field<string>("Explore Aggregator") == '# Tickets').FirstOrDefault();
using Datatable for each will take more time , so please help
 

Answers (1)