LocalDB and saving data to a file

In a PWA I want store data that is collected in the field using IndexDB. At home I want to download the data to e.g. a csv file. I guess saving data to Google Drive or attaching a file to a mail message is the way to go. But how can I achieve this using TMS Web Core?

IndexedDB is a local database, so when you use IndexedDB in a PWA on a mobile device, this data will only be on the mobile device.
If you want to download this as CSV, you'd need to add code to the application to retrieve the data from IndexedDB and for example format this as CSV in a TStringList and then perform a .SaveToFile() that will trigger the download.
If you want to use Google Drive, you'd need to implement the REST API to store the file on Google Drive in your Web Core application.

Thanks Bruna. TStringList.SaveToFile does the trick.

Fwiw, we can confirm the next release will have a grid.SaveToCSV().
So, if you would connect an IndexedDBClientDataSet to a TWebDBGrid, you can directly call grid.SaveToCSV()

It's getting better and better!

1 Like