Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Using existing ClientDataSet data in FDMemTable

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.

  1. Create a new Multi-Device Application (FireMonkey) or VCL Forms Application
  2. Place a TClientDataSet onto your form
  3. Place a TFDMemTable onto your form
  4. Right-click on the TClientDataSet component, and select ‘Load from MyBase table…’
  5. Browse to your data. In this example, I am using the country.cds file located in C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesData 
  6. Right-click on FDMemTable and select ‘Assign DataSet’. Select ClientDataSet1 and click OK.
  7. Next, bind the data to a UI control, such as TGrid using the LiveBindings Designer. This step is optional.
  8. Select ‘Save to File’ on FDMemTable. 
  9. You can save the data as an XML file, Binary file or JSON file. In this case, I saved it as a JSON file. 
  10. 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-6743c24e619e1052679066/]

 

Exit mobile version