Delphi 10.2 Tokyo Beta Blogging: Editing data in TFDMemTable during design-time

database-155892_640I received permission today to blog about the features of Delphi 10.2 Tokyo.

You might have read a lot of things about Linux support and other compiler-related improvements. As a database application developer I am very excited about this new feature:

 

 

FDMemTable  supports editing table data during design time. The data will be persisted and will also be available during run-time.

This opens FDMemTable  for quite a few new possibilities. In this example I will show how to define fields and then fill those fields with data during design-time. However, we could also simply load XML or binary data from disk. Furthermore, we could even use a query to fill up the table during design-time so that during run-time there is some default information available before the user connects to the database e.g. TFDMemTable  is also able to provide that data to other components during run-time for multiple purposes. It is much more flexible and complex than TFDTable . TFDMemTable  is much closer to a TClientDataset .

In order to show the functionality I did the following:

  1. Created a new “VCL Forms Application”
  2. Dropped a TFDMemTable  on the form
  3. Right-click the TFDMemTable  component to display its context menu:

Here you can see the new feature. Right now there is nothing to edit as the dataset does not have a field definition yet.

Thus, open up the “Fields Editor…” and add a few fields. E.g. Name, Street, Address, City, Zip and State:

fd02

As there have been no changes for Tokyo how to create fields, there is not screenshot of that.

Finally, we invoke the new feature using “Edit DataSet…”:

fd03

The window that opens shows a navigator with a grid. Both components allow us to enter and delete data easily. There is also a Clear button that allows us to delete all the data with the click of a button. That button might seem redundant, but as you can load many records from a file this button has its use. In order to load or save data from or to a file you have to use the context-menu. There are no buttons for this in this window.

With Delphi 10.2 Tokyo you can provide data for your TFDMemTables  during design-time. This feature enables not only a better design-time experience but also has its use to provide and prepare data for run-time. 

Posted in Delphi Tagged with: , , ,
3 comments on “Delphi 10.2 Tokyo Beta Blogging: Editing data in TFDMemTable during design-time
  1. Edward says:

    I want this! Productivity will go through the roof with this.

  2. Carlos Niebla says:

    Hi Holger. Good post.

    Will it be possible to get the fields from a request to a REST server to the TFDMemTable in design time?

    I want to modify an application that uses DBExpress and TClientDataSet to a REST server with TFDMemTable. I did some tests last year but there there was no easy way to get the field definitions of the REST server to the TFDMemeTable in the client application, so I felt this technology wasn’t mature in Delphi and decided to wait.

    • Holger Flick says:

      Carlos,
      I never had any issues using the REST client during design-time. When using the DataSetAdapter it even adds the fields etc. during design time to a TFDMemTable. This is not Tokyo, this already worked in Berlin for me as I showed during my blogs for the Pexels component.

Leave a Reply

Your email address will not be published. Required fields are marked *

*