I am trying to get the column name value of the datatable in the list with the highest row count.
This is the sample datatable:
I grouped this by item name and saved to a list of datatable
list = {0,1,2,3}
group (0)
A 12
A 12
A 13
group (1)
B 6
group (2)
C 3
C 3
group (3)
D 13
D 13
D 13
Is there a straightforward way we can get the value of item name of the 3 highest row count like on a datatable variable without for each?
like listDT.Max(Function (x) x.Rows.Count) but instead of int return, it will give me the item name value so I can use it on another logic.
Please refer the below post. You can pass the column name and create it as a dictionary or you can build a datatable.
TestDt.AsEnumerable().Select(Function(x) x.Field(Of String)(“YourColumnName”).Trim).ToArray().Where(Function(y) Not String.IsNullOrEmpty(y)).ToArray().Count