Excel Manipulation Using LinQ

DoubleNumberTableDoubt
In the attached Screenshot above table is the Input Table I need a LinQ for the below output table.

Thank you

Hi,

Can you try the following sample?

dt.AsEnumerable.GroupBy(Function(r) r("LOS_No").ToString).Select(Function(g) dt.Clone.LoadDataRow({g.Key}.Concat(g.Select(Function(r) r("Loan_No_L").ToString).Distinct()).ToArray,False)).CopyToDataTable()

Sample
Sample20240319-5.zip (8.8 KB)

Regards,

Iā€™m getting the correct output but I missed one column(Without ā€œLā€) for both First Loan No & Double Loan No, can you please update your LinQ a bit?

@Yoichi Are you solving it?

1 Like

How about the following?

dt.AsEnumerable.GroupBy(Function(r)  r("LOS_No").ToString).Select(Function(g) dt.Clone.LoadDataRow({g.Key}.Concat(g.Select(Function(r) Tuple.Create(r("Loan_No_L").ToString,r("Loan_No_L_Without_L").ToString)).Distinct().SelectMany(Function(t) {t.Item1,t.item2})).ToArray,False)).CopyToDataTable()

Sample20240319-5 (2).zip (9.7 KB)

Thank you so much for the quick solution!!!

1 Like

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