Before You have to Clone the headers from readDt and pass instead of resultdt in below expression
Dtâ>InputDt
ResulDtâ>Inputdt.clone
(From d In Dt.AsEnumerable Group d By k=d(âServicefallâ).toString.Trim Into grp=Group Let ra =New Object(){k} Select resultDT.Rows.Add(ra)).CopyToDataTable
May I ask what do you intend to display/write range to your excel? The reason Iâm asking is I donât see any other column or aggregation/computation on your LINQ query as a result of your grouping. And as far as I know, what youâll get will be a result similar to a âSelect Distinct Servicefallâ query.
If youâre intent is to display all rows but grouped, it may be achieved by just sorting a column in your Data table. Or iterate thru the result of your LINQ query as it is a List of DataTables, to get each grouping.
I have implemented this, but now I only get the values from the column âService caseâ where I need the whole row and all IDâs are in the new table, not the grouped ones.
if you want them all in just 1 data table, then use Merge. However, as I pointed out, this will just look like your âoriginalâ data table sorted by âServicefallâ
Can someone tell me what the difference is between the For Each activity and a loop in a FlowChart?
Basically, I thought you could just replace them with my solution.