Backup/Restore your Local Table by Email

There are situations that all you need for your app to work is a local table to store some data for your app and you do not need the mobile to be connected to the internet all the time.

But, what if the user had to reinstall the app? All data in the local table is lost and there is no option to even back it up before reinstalling the app.

This demo uses the Email share component to save the data in an email message so that it can be retrieved later.

Of course, you can choose to use Google Apps Script to automate the email process but this is beyond the scope of this tutorial.

The demo app is a simple single screen app with a DVL showing the content of the local table.

  • The Backup button will loop through the rows in the table making a JSON string and once done will send this string to a designated email.
  • The Clear button will delete all rows in the local table.
  • The Restore button will ask the user to paste the JSON received by email in the Text Input field to use it to repopulate the local table again.
  • For ease of testing, I have provided a variable with sample data so one can use it to test the restore process.

https://x.thunkable.com/projectPage/625ec4ec191f060012a6802b

Code Blocks:

  • Converting table rows to JSON string

  • Send JSON rows to email
    image

  • Restoring data to local table
    image

  • Making sure the user pasted the JSON
    image

  • Verifying the JSON to be valid
    image

4 Likes