Not able to select the first element

Hi All,

I am using the below query to select the first element but it is not working correctly . Please can anyone help me with this . The query is -
(From d In DT.AsEnumerable
Group d By k=d(“Reinsurance/Treaty Name Code”).toString.Trim Into grp=Group
Select grp.First()).CopyToDataTable

Hi @Yoichi
Any help from your end would be really appreciated.

Hi @Ritika_Singh

Check with the below expression!

** dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“Columnwithduplicatevalues”)).Select(Function(g) g.First).CopyToDataTable**

Regards

1 Like

Not working

Hi @Ritika_Singh

Can we have the screen shots of Inputs and Expected Output?

Regards

1 Like