New in 10.2: Editing Data in TFDMemTable at Design-Time
The new Delphi 10.2 Tokyo (and corresponding C++Builder and RAD Studio version) has been released and it has many new smaller and bigger features. Clearly the biggest, most visible new thing is the new Delphi Linux 64-bit compiler and the capability to build server-side apps with Delphi. It did not take too long for the first Delphi developers to start playing with building GUIs for Linux with Delphi FireMonkey.
One of my favourite new features in Delphi 10.2 is the possibility to edit data in the "TFDMemTable" component at design-time. This component is a powerful FireDAC in-memory data store. In many respects it is similar to traditional "TClientDataSet", but arguably it is more powerful. This new feature makes it even more useful.
Create a new app and drop "TFDMemTable" component on the form. This could be Delphi or C++Builder, VCL or FireMonkey, but in my case it is a new Delphi "VCL Forms Applications". The "TFDMemTable" component can store data that have been downloaded from the server-side application, loaded from a local file, assigned at design-time from another dataset or simple created "in-place"!
Before we can edit data, we need to create the dataset structure or in other words define the dataset fields. Right-click on the "FDMemTable1" component and select "Fields Editor...".
The "Fields Editor" windows will open. Initially it is empty, because there are no fields defined. We will create two new fields.
One integer field named "ID" and one string field called "NAME".
Now we have the metadata defined. So far this capability existed in previous Delphi version. What is new in 10.2 "Tokyo" is that you can edit data at design-time! Just right-click on the "FDMemTable1" component and select "Edit DataSet..." from the context menu.
Here we can enter some test data. For example names of different Embarcadero products.
After we are done with editing the data, we can build a simple graphical user interface to display data on the form and make them editable for the end user. Just add a "TDataSource" component and hook it to "TFDMemTable". Now just "TDBGrid" and "TDBNavigator" need to be added to the form and connected to the data source. Here we go!
That's really cool! The possibilities are endless! Think "Local SQL";-) Notice that this data exists just in the form file, not even in a file or a database. Excellent solution for quick prototyping of data driven user interfaces.
Please login first in order for you to submit comments
- Page :