Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linq orderby pivot results

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
0
0
US
I am trying to pivot my data by year and month. The pivot works fine, but it is in random order.

I can't seem to figure out how to order the data by the year and month.

Code:
         var rows = source.GroupBy(rowSelector.Compile() )
                          .Select(rowGroup => new
                          {
                             Key = rowGroup.Key,
                             Values = columns.GroupJoin(
                                 rowGroup,
                                 c => c,
                                 r => columnSelector(r),
                                 (c, columnGroup) => dataSelector(columnGroup))
                          });
Values is the pivoted data.

I can't seem to put an orderby anywhere that doesn't give me an error.

Thanks,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top