cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Offline App - LoadData returns an error

Hello,

 

I am trying to build a simple mechanism to my app to extend its use offline.

 

What I want to do: OnStart of the app, if there is connection, I want to save four tables to four different collections and then save those collections to my local cache. If there is no connection, I want to load those four tables into the collections.

 

What I have:

If(
// Check for connection
Connection.Connected,
// Connection - Save data to collections
ClearCollect(CollectionOne, TableOne);
ClearCollect(CollectionTwo, TableTwo);
ClearCollect(CollectionThree, TableThree);
ClearCollect(CollectionFour, TableFour);
// Save tables to local cache
SaveData(TableOne, "One");
SaveData(TableTwo, "Two");
SaveData(TableThree, "Three");
SaveData(TableFour, "Four"),
// No Connection - Retreive data from local cache & save in collections
LoadData(CollectionOne, "One", false);
LoadData(CollectionTwo, "Two", false);
LoadData(CollectionThree, "Three", false);
LoadData(CollectionFour, "Four", false);

);

 

What is happening:

I keep getting this error as if the name of the file does not exist: "There was a problem loading your data".

However, as you can see all names ("One", "Two", "Three", "Four") are matching. Is there something I am doing wrong when saving the data (SaveData)?

 

On a side note, the documentation for SaveData is not consistent/clear.

The online microsoft docs at https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata say: SaveDataCollectionName ) - Collection - Required. Collection to be stored or loaded.

In Power Apps, SaveData( source, name) - Source: A table whose contents will be saved.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Offline App - LoadData returns an error

A couple if things to try, based on my experiences with offline apps.

 

  1. Your loading pattern is good, except you should save the Collection (not the source); outlined below
    • If Connected/Not-Metered/Etc
      • ClearCollect(collection, Source)
      • SaveData(collection, saveName)
    • Else
      • LoadData(collection, saveName)
  2. Run the app Connected the first time it runs, and (potentially) after publishing changes
  3. The app will only load data when running on a mobile device Power App's app; will not work in browser or Studio
  4. Be mindful of the size of the collections relative to the device's ability to process them (not usually an issue, but potential exists)
  5. It really shouldn't matter, but be a bit more descriptive in naming the saved data
    • Ex: "savedCollectionName"

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Offline App - LoadData returns an error

A couple if things to try, based on my experiences with offline apps.

 

  1. Your loading pattern is good, except you should save the Collection (not the source); outlined below
    • If Connected/Not-Metered/Etc
      • ClearCollect(collection, Source)
      • SaveData(collection, saveName)
    • Else
      • LoadData(collection, saveName)
  2. Run the app Connected the first time it runs, and (potentially) after publishing changes
  3. The app will only load data when running on a mobile device Power App's app; will not work in browser or Studio
  4. Be mindful of the size of the collections relative to the device's ability to process them (not usually an issue, but potential exists)
  5. It really shouldn't matter, but be a bit more descriptive in naming the saved data
    • Ex: "savedCollectionName"

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Offline App - LoadData returns an error

Hello @GarethPrisk ,

 

Thanks for the feedback.

 

  1. As I have said on this post, documentation is consistent so thank you for confirming SaveData's first parameter is the collection and not the source.
  2. Yes, so it correctly saves the update sources.
  3. Yes, testing has been done through mobile device.
  4. Now, for this part, I though that might be the issue since the collections are of a decent size; However, I tried the exact same process but with a collection containing only one record and it is still failing.
  5. The naming conventions in the post was for privacy reasons. 

In all, after updating the source for the collection in SaveData, it works nicely.

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (689)