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:
- Created a new “VCL Forms Application”
- Dropped a TFDMemTable on the form
- 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:
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…”:
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.