Data table operation


Hi, I need to produce the output using the input data. I have used transpose to achieve this, but there is no luck. could you please help on this one… I have attached the both input and output structure

@lk_18
We can do it with a LINQ

prepare the target Data Structure with a build datatable
grafik

then we can do:
grafik
Input/Output
grafik

there are 2 items which are different:

  • LeftPadded 0 on the date
  • not ordered

But this two things we can enhance by following:

(From d In dtData.AsEnumerable
From x In Enumerable.Range(1, dtData.Columns.Count - 1)
Let dp = Date.ParseExact(dtData.Columns(x).ColumnName,"d-MMM-yy", CultureInfo.InvariantCulture)
Let ra =New Object() {d(0), dp.toString("dd-MMM-yy"), d(x)}
Order By dp, d(0).toString
Select dtDataTransformed.Rows.Add(ra)).CopyToDataTable

grafik

Ensure Following:
grafik