I usually like to have my data presented in a certain order. Such as:

Often data comes from Databases, so it is often possible to use SQL’s ORDER BY to sequence data in the order you wish before you read it into a TDataSet.

But sometimes data comes from multiple sources and.. well, life gets messy…​ deal with it.

You can easily sort the data in your TDataSet, by selecting one or more Columns and a sort direction.

var
  s : string;
begin
   s := 'Name';
   // here we'll sort by TWO columns, applied in the order we define
   // specify column by name
   dataset1.Columns.Column[ s ].SortDirection := sdAscending;
   // specify column by index=2, applied next
   dataset1.Columns.Column[ 2 ].SortDirection := sdAscending;
   dataset1.Sort;
end;

There are also sortlocaleinsensitive and sortcaseinsensitive option flags which can help for various needs.