@cybzom
give a try on following:
build the output datatable within the structure a from above:
Give a try on following as it is a quick Prototype:
(From d In dtdata.AsEnumerable
Group d By k=d(“Specifics”).toString.Trim Into grp=Group
Let lk = grp.ToDictionary(Of String, Object)(Function (x) x(0).toString.Trim, Function (x) x(2))
Let ra = {“A”,“B”,“C”,“D”,“E”}.Select(Function (v) lk(v)).toArray
Let ra2 = ra.Prepend(k).toArray
Select dtOutput.Rows.Add(ra2)).CopyToDataTable
Maybe you want to bring some dynamics and robustness into the code. Therefore you can just split the groups into a list(of list(Of DataRow)) (outer list=Group, Inner list=GroupMembers)
(From d In dtdata.AsEnumerable
Group d By k=d(“Specifics”).toString.Trim Into grp=Group
Select grp.toList).toList
And process the groups within a for each. Within a nested process block the group memebrs can be processed