we would like to inform that the LINQ count operator in VB.Net is critical and only partly implemented within the platform. We can rewrite with a Where and counting the results like:
Where(Function (x) …).Count
it could be the case that you are looking for a group by and counting the resulting group members.
Can you share some sample data?
refered to the datatable form your XAML
Hi @Luan ,
Use below select query to get the details. Dt.Select("ColumnName in ('MG 2', 'MA 1' ,'MS 2')").CopyToDataTable()
To get the total count Dt.Select("ColumnName in ('MG 2', 'MA 1' ,'MS 2')").Length
(From d in dtData.asEnumerable
Group d by k=d(“C”).toString.Trim into grp=Group
Select t= Tuple.Create(k, grp.Count)).ToDictionary(Function (x) x.Item1, Function (x) x.Item2)
With a prepared datatable, having 2 cols, Key, Count - dtStatistic we can do:
dtStatistic =
(From d in dtData.asEnumerable
Group d by k=d(“C”).toString.Trim into grp=Group
Let ra = new Object(){k, grp.Count}
Select r= dtStatistic.Rows.Add(ra)).CopyToDataTable
you will get back a datatable with the statistical info