pls i need to arrage my data in datatable input 1 to ouput table 1
Module | date(year) | xrate | yrate | cumrate
----------+------------+--------+---------+---------
No2_gft 2013 50 65 458
No2_gft 2014 59 69 458
No2_gft 2015 59 69 458
No2_gft 2016 59 65 458
No3_gft 2013 50 65 458
No3_gft 2014 59 69 458
No3_gft 2015 59 69 458
No4_gft 2016 59 65 458
No4_gft 2013 50 65 458
No4_gft 2014 59 69 458
No4_gft 2015 59 69 458
No3_gft 2016 59 69 458
to
Module ; Valuetype ; y2013 ; 2014; 2015; 2016
No2_gft ; ; xrate; 50; 65; 458
No2_gft yrate 65 69
just like a transpose
It's unclear how do you want to aggregate or arrange your data, but if you want to aggregate them by
yearyou can do this:This will give you a list of grouped years with the
FirstOrDefault()as an aggregate function:Or you can group by an anonymous type:
Instead of only
m.date, since yourdate,xrateandyrateare the same for all rows.Edit: Well, for pivoting this list of modules, I couldn't find any thing shorter and easier than this:
Give it a tray. You should add a new class:
The
PivotedModulesshould contains the following data: