Reputation: 345
on Delphi XE2, I have a ClientDataSet which have many fields as Name, ... It have a field named Date, as value type String. Containing a Date (dd/mm/yyyy) I want to print content of ClientDataSet, using FastReport. I want before to sort content ascending according to the Date field. I'm using index. But when doing this, sorting does only sorts fields according to the content of the Date string before the "/". form example dates like : 12/11/2012, 15/10/2012, 01/12/2012 are sorting like this : 01/12/2012 - 12/11/2012 - 15/10/2012. ny idea how doing this correctly ?!
Upvotes: 0
Views: 1011
Reputation: 3820
You have some options:
TDatasetProvider
's OnGetRecords event and populating it as a Date field.I personally suggest the first approach if possible.
Upvotes: 0
Reputation: 47714
The sorting is correct! As you have a string field, the sorting is made like strings are sorted i.e. from left to right. If you want it sorted by Date you need either a date field or sort the string representation like yyyy/mm/dd.
Upvotes: 3