Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Delphi

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…’LoadMybase
  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.AssignDataSet
  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. 
    SaveAsDialog
  10. Now you can use this data and load it directly to an FDMemTable component without                         assigning it to a TClientDataSet component.

             LoadFromFile

Here is a small section of the .JSON data file:

 


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES