Hii All…
I have a Excel sheet which has given below.
In this Sheet i have to count the Rno column value according to the country column.
Like below image
Please help me with this all.
TIA…!
Regards,
Soundarya
Hii All…
I have a Excel sheet which has given below.
In this Sheet i have to count the Rno column value according to the country column.
Like below image
Please help me with this all.
TIA…!
Regards,
Soundarya
Hi,
Hope the following sample helps you.
dt = dt.AsEnumerable.GroupBy(Function(r) r("country").ToString).Select(Function(g) dt.Clone.LoadDataRow({g.First().Item("id").ToString,g.Key,g.Count.ToString},False)).CopyToDataTable()
Sample20221018-3.zip (2.7 KB)
Regards,
dt = dt.AsEnumerable.GroupBy(Function(r) Tuple.Create(r(“id”).ToString,r(“country”).ToString)).Select(Function(g) dt.Clone.LoadDataRow({g.First().Item(“id”).ToString,g.First().Item(“country”).ToString,g.Count.ToString},False)).CopyToDataTable()
It works Thankyou @Yoichi
I have changed my sheet for the 2nd process. so, for that that the input looks like given below,
And the output is according to id and country column
like this,
Could you help me with this?
TIA…
regards,
Soundarya
HI,
Can you try the following expression?
dt.AsEnumerable.GroupBy(Function(r) Tuple.Create(r("id").ToString, r("country").ToString)).Select(Function(g) dt.Clone.LoadDataRow({g.key.Item1.ToString,g.Key.Item2,g.Count.ToString},False)).CopyToDataTable()
Sample20221018-3v2.zip (2.8 KB)
Regards,
Hi @Yoichi
Thank you so much for the solution
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.