I am using 1 query that groups and joins column 13 at the same condition and in the same query i want column 12 joined as well.
(From d In InputFile.AsEnumerable() Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim() Into grp = Group Let s = String.Join(“,”, grp.Select(Function(x) x(13).ToString())) Let ra = New Object() {k1, k2, s} Select joiningDT.Rows.Add(ra)).CopyToDataTable()
Please help team.
(From d In InputFile.AsEnumerable()
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim(), k3 = d(12).ToString().Trim() Into grp = Group
Let s = String.Join(“,”, grp.Select(Function(x) x(13).ToString()))
Let ra = New Object() {k1, k2, k3, s}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()
or
(From d In InputFile.AsEnumerable()
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim(), k3 = d(11).ToString().Trim() Into grp = Group
Let s12 = String.Join(“,”, grp.Select(Function(x) x(12).ToString()))
Let s13 = String.Join(“,”, grp.Select(Function(x) x(13).ToString()))
Let ra = New Object() {k1, k2, k3, s12, s13}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()
(From d In InputFile.AsEnumerable()
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim()
Into grp = Group
Let s13 = String.Join(",", grp.Select(Function(x) x(13).ToString()))
Let s12 = String.Join(",", grp.Select(Function(x) x(12).ToString()))
Let ra = New Object() {k1, k2, s12, s13}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()
(From d In InputFile.AsEnumerable()
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim() Into grp = Group
Let s = String.Join(“,”, grp.Select(Function(x) x(13).ToString()))
Let r = String.Join(“,”, grp.Select(Function(x) x(12).ToString()))
Let ra = New Object() {k1, k2, s,r}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()
Or
(From d In InputFile.AsEnumerable()
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim() Into grp = Group
Let s12 = String.Join(“,”, grp.Select(Function(x) x(12).ToString()))
Let s13 = String.Join(“,”, grp.Select(Function(x) x(13).ToString()))
Let s = s12 + "," + s13
Let ra = New Object() {k1, k2, s}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()
(From d In InputFile.AsEnumerable()
Where d(12).ToString isNot Nothing and d(13).ToString isNot Nothing
Group d By k1 = d(6).ToString().Trim(), k2 = d(8).ToString().Trim()
Into grp = Group
Let s13 = String.Join(",", grp.Select(Function(x) x(13).ToString()))
Let s12 = String.Join(",", grp.Select(Function(x) x(12).ToString()))
Let ra = New Object() {k1, k2, s12, s13}
Select joiningDT.Rows.Add(ra)).CopyToDataTable()