cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Meneghino
Community Champion
Community Champion

Logical inconsistency? LoadData gives error if app opened for the fist time

If you refer to this post by @csm there seems to be a logical incosistency with the LoadData and SaveData functions that we have not been able to resolve, any ideas are welcome.  Otherwise, as csm suggests, there should be a way to check for the presence of data on the device before calling the LoadData function.

 

Basically, LoadData/SaveData should be used to store user preferences, but if the user is opening the app for the first time or on a new device then this data is not there and an error is given by the first LoadData statement.  You cannot run a SaveData statement first because otherwise it would over-write the stored preferences from a previous session.  (Or at least I have not found a way around that)

9 REPLIES 9
v-monli-msft
Community Support
Community Support

Hi Meneghino,

 

I found a thread that might answer your question.

https://powerusers.microsoft.com/t5/PowerApps-Forum/load-data-and-sync/td-p/95

 

"Savedata and Loaddata are temporary. If you are looking for a permanent solution, you will want to look into the Update, UpdateIf, and Patch functions. They will record information straight into your Excel tables. 

 

Once information is saved to your tables, you can use Refresh to reload any changes. Changes are automatically reloaded upon closing and opening the app, so you won't need to use Savedata and Loaddata."

 

Also, see the concept of "Savedata ans load data":

The SaveData function stores a collection for later use under a name.

The LoadData function re-loads a collection by name that was previously saved with SaveData. You can't use this function to load a collection from another source.

LoadData doesn't create the collection; the function only fills an existing collection. You must first create the collection with the correct columns by using Collect.

Storage is encrypted and in a private location on the local device, isolated from other users and other apps.

 

https://powerapps.microsoft.com/en-us/tutorials/function-savedata-loaddata/

 

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Mona, I believe the intent of SaveData and LoadData is for example to store user preferences on a particular device.

Hence the logical incosistency.

Please refer to this post:https://powerusers.microsoft.com/t5/PowerApps-Forum/Store-user-settings/m-p/13467

Many thanks.

Maverick
New Member

I'm also frustrated by this issue. Seems to me there's two simple solutions:

  1. Add an optional parameter to the LoadData function to error if the file doesn't exist (named something like "ErrorIfFileNotFound"). Default value is true.
  2. Provide a new function to check if a file exists (named something like "FileExists(filename)").

These capabilities have been around since VBScript days. Might be time to dust off some classic ASP...

Anonymous
Not applicable

for me its a "bug", the savedata get lost after the app is saved in powerapps designer and the app get an update or any other reason.

lets say if me save data, this are my data, no one else touch it.

 

 

 

 

It looks like this has been fixed.  When I set the third parameter of the LoadData function to true, it ignores the error.

Povilas
Regular Visitor

It looks like the issue is back in newest version and the third parameter (to ignore error if file does not exist) is not in effect...

Yep just found this on an app thats has true set to ignore errors. It has been running fine for last 6 months, now all of a sudden it has stopped ignoring and generates an error for new users on first access.

 

is there a time line for this to be fixed.????

AlexN
Advocate V
Advocate V

Still not fix...
The error is very irritating for my users. especially as there is even this extra 3rd paramter just for that.

Using the new "IfError" function doesn't help either, the error is still displayed

niaadami
Frequent Visitor

Same here three years later... 😞

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,061)