{
IndexDefs, IndexName, Update, Count, Items, Fields, Name example
This example uses the IndexName property to sort the records in a client dataset on the CustNo and OrderNo fields.
}
{ Get the current available indices }
ClientDataSet1.IndexDefs.Update;
{ Find one which combines Customer Number ('CustNo') and Order Number ('OrderNo') }
for I := 0 to ClientDataSet1.IndexDefs.Count - 1 do
  if ClientDataSet1.IndexDefs.Items[I].Fields = 'CustNo;OrderNo' then
    begin
    { set that index as the current index for the dataset}
    ClientDataSet1.IndexName := ClientDataSet1.IndexDefs.Items[I].Name;
    end; 
