codeice / linqtoexcel

Automatically exported from code.google.com/p/linqtoexcel
0 stars 0 forks source link

orderby not working? #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have tried this out on the UK General election results spreadsheet
(exported to XLS) and it all seems to be working nicely, with the exception
that my orderby clause doesn't seem to do anything.

I've tried ordering on a few different properties but with no success.

My data is available here:
http://spreadsheets.google.com/ccc?key=tdLut_gO0qo_C0JevIxnZ2g

The code is as follows:
var repo = new ExcelQueryFactory();
repo.FileName = @"..\..\..\Data\General election 2010 results.xls";
repo.AddMapping<Result>(x => x.VotePercent, "%Vote");
var unpopularWinners = from p in repo.Worksheet<Result>("FULL CONSTITUENCY
DATA")
   where (p.Party == p.Winner) && (p.VotePercent < OneThird)
   orderby p.VotePercent ascending
   select p;

   foreach (var winner in unpopularWinners)
   {
      Console.WriteLine(String.Format("{2}%: {0} ({1})", winner.Candidate,
winner.Party, winner.VotePercent));
   }

public class Result
{
    public string Seat { get; set; }
    public string Candidate { get; set; }
    public string Party { get; set; }
    public int Vote { get; set; }
    public double VotePercent { get; set; }
    public string Winner { get; set; }
}

Original issue reported on code.google.com by mark.he...@gmail.com on 10 May 2010 at 10:08

GoogleCodeExporter commented 8 years ago
This has been fixed in the latest download (LinqToExcel_1.3.70)

Original comment by paulyo...@gmail.com on 12 May 2010 at 5:22

GoogleCodeExporter commented 8 years ago
brilliant, thanks for the super-quick turnaround

Original comment by mark.he...@gmail.com on 12 May 2010 at 6:16