cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

Catch Power Apps LoadData Errors

"IgnoreNonexistentFile - Optional. A Boolean value indicating what to do if the file doesn't already exist. Use false (default) to return an error and true to suppress the error."

Using the above only suppresses the error.

It will be very useful to be able to catch the error and create a custom error message using Notify() and then assign any additional actions based on the presence of an error or no presence of save data.

Example: I have a "Continue previous session" button which is disabled or hidden if no save data exists but enabled or visible if there is data.

Currently, based on my tests, using Errors, IfError or IsError do not pick up the error when using "LoadData( Collection, Name , false)". This would be the easiest way to manage this.

It also doesn't work if I put LoadData() inside IsEmpty( Errors ( ... ) ).

Status: New
Comments
rwittels
Resolver I

I have been approaching this incorrectly. I resolved this by doing the following:

App OnStart

LoadData(Checklist,"LocalCache",true)

I use "true" to suppress errors if there is no "LocalCache" file.

"Continue previous session" Button

DisplayMode

If(
    !IsBlank(First(Checklist).Employee) &&
    !IsBlank(First(Checklist).Username), 
    Edit, 
    Disabled
)

"Employee" and "Username" are two fields in my collection that cannot be blank. So if they are blank, it is likely that the collection did not load. The button is then disabled as there was no data loaded.

It's that simple actually. I tested it a few times and it works great.