Group Datatable by Value and Joining Row values

I would like to group MainDT by [WorkOrderNo] and combine [Task] from multiple rows to under [Task]. Here is some sample data.

Any help on how to achieve with an assign activity would be greatly appreciated. :pray:

welcome to the forum

have a look here:

give a try

Assign Activity:
dtResult = MainDT.Clone

Assign Activity:
dtResult =

(From d In MainDT.AsEnumerable
Group d By k=d("WorkOrderNo").toString.Trim Into grp=Group
Let ts = grp.Select(Function (t) t("Task").toString.Trim)
Let tj = String.Join(" ", ts.Select(Function (tn, i) (i+1).toString &". " & tn))
Let rf = grp.First()
Let ra = New Object(){rf(0), rf(1), k, rf(3), rf(4), tj}
Select r = dtResult.Rows.Add(ra)).CopyToDataTable
1 Like

@ppr Worked like a charm! Thank you very much Peter for your prompted reply!

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