Monday 22 July 2019

ClientDataSet SaveToFile writes the field values in reverse order

I have noticed that when I have a TClientDataSet with a single record and I use 'SaveToFile' to save the values to an XML files the order of the fields in the XML is in reverse order. For example if you have the following in the TClientDataSet:

TableID
Name
Address

When this is saved to an XML file the meta data is in the correct order, but the values for the fields in the XML is in reverse order.

Address
Name
TableID

I wonder if this is done by design.

The version of Delphi I am using is Tokyo.

2 comments:

  1. Is it really in reverse order, or is it just sorted alphabetically? Your example does not make this clear.

    ReplyDelete
    Replies
    1. No, this was example field names that happen to be in alpha order (should have given better example field names). The actual order in the application of the field names is V,C,R,S,D,E,D,R so is not alphabetic.

      Delete