Author: Davide Rubbiani
For today’s #DelphiWeek post, I thought I would highlight how you can use existing ClientDataSet (.cds) data in FDMemTable. With this approach, you can also save existing .cds data as JSON, for example. In this tutorial, I am going to create a new application, but you could also use this approach with an existing application.
- Create a new Multi-Device Application (FireMonkey) or VCL Forms Application
- Place a TClientDataSet onto your form
- Place a TFDMemTable onto your form
- Right-click on the TClientDataSet component, and select ‘Load from MyBase table…’
- Browse to your data. In this example, I am using the country.cds file located in C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesData
- Right-click on FDMemTable and select ‘Assign DataSet’. Select ClientDataSet1 and click OK.
- Next, bind the data to a UI control, such as TGrid using the LiveBindings Designer. This step is optional.
- Select ‘Save to File’ on FDMemTable.
- You can save the data as an XML file, Binary file or JSON file. In this case, I saved it as a JSON file.
- Now you can use this data and load it directly to an FDMemTable component without assigning it to a TClientDataSet component.
Here is a small section of the .JSON data file:
[crayon-672a88f24a1cb437196660/]