Regarding Linq(Multiple column selection)

Hi All,

I want all columns from this query but when I select it as : (Select new { “column1” “column2”}
it doesn’t work. Can someone please help me?
Here you can get my code :

(From row As DataRow In opdt
Group row By TransactionKey = row.Field(Of String)(0) Into Group
Select {TransactionKey, String.Join(",", From i In Group Select i.Field(Of String)(18))}).ToList

where how to select multiple columns? as Column0. column1, column2 .

Thanks in advance,
Hemal

Hi @hemal,

@ppr can help you in that case !!

Thanks @Shikhar_Tandon

Hi @ppr can you please help ?

Thanks in advance

Exactly what i want to do is, please refer below table :-
Id Name Field
1 abc IT
2 xyz IT
3 aaa Chemical
4 pqr IT
so I want the output like, :-

ID Name Field
1 abc,xyz,pqr IT
2 aaa Chemical

Hope you got it ! Now I already have a first DT from where I am converting the next Table. OR do you have any other idea or logic please let me know.

Thanks.

@hemal
it looks like you want to do following:
grouping by Field
ID - is the IndexCounter for the group
Name - Aggregated Name values from the group, separated by comma

grafik

find demo xaml here:
Hemal_GroupBy_1Col_StringAggGrpIdxResult.xaml (7.7 KB)

2 Likes

Thank yo soooo much @ppr :slight_smile: :slight_smile:
So happy with the solution :slight_smile: Again thanks :slight_smile:

Regards,
Hemal

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.