What dataset is preferred in a VCL application?

Hi,

I have a VCL client accessing my xData/Aurelius server. I need to pull some data to the client and use the CachedUpdate feature. I also need to be able to save/restore data locally in case off client being offline.

May I ask what dataset type would be the best starting point?
TWebClientDataSet, TXDataWebDataSet or maybe TAureliusDataSet?

Thank you.

Hi @Olsen_Leif_Eirik, neither option. Closest is TAureliusDataset, but it doesn't offer what you want, which is rather complex.

In a VCL application, you don't have the TWebClientDataset or TXDataWebDataset, so you can discard those.

If your server is XData, then we're talking about a REST server. You retrieve JSON information from the server. If you use XData client, then the client automatically convert JSON to Delphi classes, thus you are retrieving Delphi objects from the server (not raw table data).

TAureliusDataset is perfect for binding Delphi objects to data-aware controls. So yes, use TXDataClient to retrieve your PODO or entity objects from XData server, and use a TAureliusDataset to bind those objects to data-aware controls. This way you can easily view, browse data in objects, and also edit them.

But then, updating it back to the server or saving in local cache, that is totally up to your application. TMS BIZ includes TMS Echo, our data replication library, which intention is exactly that: save data locally while offline, then replicate back to the server when online. But that's never plug-and-play, it requires a setup, and saving to the local database is always up to you as well.

Thank you again Wagner for a very descriptive response, much appreciated.

I was (and maybe still) thinking about using Echo for my offline requirements. It looks to be just what I need, but I'm a bit reluctant to include another technology that I'm not too familiar with. Don't get me wrong, I'd love to use it, and will most likely eventually do so, it's just that I'm already juggling xData, Aurelius, Logging, Sparkle, Sphinx, TMS Modeler, and that is just the none-visual part of my project.

The way I handle the offline bit today is actually using TXDataClient:

  1. If my REST server is available: My VCL Client loads data (entities) from REST server using TXDataClient into FDMemTables with CachedUpdates enabled. Data is then immediately save data locally.
  2. If my REST server is NOT available: My VCL Client loads data (entities) from locally stored data (from the previous run) into the same FDMemTables still with CachedUpdates enabled.
  3. {TODO Item} : Data updates are done immediately to the REST server if server is available, or just kept in the ChangeLog if REST server is not available.
  4. At VCL Client shutdown data is again stored locally with any pending changes.

About TWebClientDataset and TXDataWebDataset not being available for VCL, I was mislead to believe they where available as they are available design time for a VCL applications.

1 Like

I totally understand you. If you have solved your problem, or if you have a different workflow, it makes lots of sense.

Since we are bound to Delphi IDE, and there is no such "Web platform", we couldn't simply make Web Core components disabled from the VCL - they are actually in essence VCL components at design-time, such as the form designer.