I have a data table where I have some rows which have all the columns values same except one (note column). I want to merge that row in to one. Example is below
Thanks in Advance
I have a data table where I have some rows which have all the columns values same except one (note column). I want to merge that row in to one. Example is below
Thanks in Advance
Hi,
Can you try the following sample?
dt = dt.AsEnumerable.GroupBy(Function(r) Tuple.Create(r(0).ToString,r(1).ToString,r(2).ToString,r(3).ToString)).Select(Function(g) dt.Clone.LoadDataRow({g.Key.Item1,g.Key.Item2,g.Key.Item3,g.Key.Item4,String.Join(",",g.Select(Function(r) r("note").ToString))},False)).CopyToDataTable
Sample20230210-4L.zip (8.4 KB)
Regards,
HI,
Can you share your input as file? It’s no problem if dummy data.
Regards,
HI,
The following is grouping by column “Booking No”,“Booking Component ID”, “Item No” and “Booking Status” and concatenate string in “note” column. In remaining column, the first row is kept. Does this work for you?
Or do you need grouping by all the columns except “note” column?
Sample20230210-4Lv2.zip (21.2 KB)
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.