Question : How to sort grid view grouping in delphi by different value and not by caption of the text?

When I have a grid view and sort it by name field, for example, Task Name, it sorts it alphabetically.  How can I sort it different? For example, Task A is the 2nd group that I want to show and Task B is the 1st I want to show on the list. Currently it defaults to alphabetical sort so it always shows as Task A then Task B. How can I set it to show grouping (either on Form Show or when the user groups it by that field) to show as Task B first then Task A?

Answer : How to sort grid view grouping in delphi by different value and not by caption of the text?

To expand a bit on the answer that Ferruccio68 provided, If you want the data sorted in a manner that does not conform to either an alphabetic or numeric sort in either an ascending or descending order, then you wil need to add a column to your data/query that will provide the means for you to control the order of appearance.

To illustrate, I make it a habit to add a ReportOrder column (of type Integer) to auxilliary tables (e.g. a Status table, or a Priority table) so that I can link to that table and then use that ReportOrder column to control the order in which data is presented on a form or within a report.

Random Solutions  
 
programming4us programming4us