Export to GitHub

linqtoexcel - issue #25

orderby not working?


Posted on May 10, 2010 by Quick Dog

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; } }

Comment #1

Posted on May 12, 2010 by Swift Rabbit

This has been fixed in the latest download (LinqToExcel_1.3.70)

Comment #2

Posted on May 12, 2010 by Quick Dog

brilliant, thanks for the super-quick turnaround

Status: Fixed

Labels:
Type-Defect Priority-Medium