Canvas Apps Controls Offline

E – Export/Import – Learn how to download data

A shipping port somewhere in Singapore
A shipping port somewhere in Singapore

Introduction

Export/import controls have been available for a long time in Power Apps. However, they are probably ones that I didn't know about for the longest time. They are pretty useful and have multiple use cases. For example, makers use SaveData/LoadData to implement offline capabilities. However, these functions save the data in cache. So, if you clear the cache, you lose all of your saved data. On the other hand, Export control downloads a collection into a file that is saved on your device's hard disk. Import control can then import the data from a saved file into a collection. Another use case is if you want to share data across apps without writing the data back to a database, users can share these files into which the data is downloaded. That being said, keep in mind that the Export control saves data in an unencrypted format. So this functionality isn't recommended for sensitive data like SSN's, data of births, etc.

To learn more about these controls, click here.

Export/Import example

Here is a working example of using the Export/Import controls. The Load Data button loads Accounts into a collection. The OnSelect of that button is:

ClearCollect(
    colAccountsForExport,
    Accounts
);

Export control downloads a collection of Accounts. It's Data property is set to a collection, colAccountsForExport in my case. Then the Import control imports that collection of records into another collection. The OnSelect of the import control is:

ClearCollect(
    colImportedAccounts,
    Import1.Data
)

where Import1 is the name of the import control.

Export/Import example
Export/Import example

Stay tuned for the remaining 21 tips!

Recent articles

  1. D - Dates - learn how to format!
  2. C - Custom pages - how to add multiple screens?
  3. B - Batch update using ForAll or not - Which is better?

Leave a Reply