web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue with LoadData in...
Power Apps
Unanswered

Issue with LoadData in App.OnStart

(1) ShareShare
ReportReport
Posted on by 4

I've started working on an app that I had put down for a few months due to other work obligations coming up.

 

Initially, I had been using LoadData() for a few settings I wanted to keep for the user's next session, which had been working fine.  However, after starting it up again a few months later, it suddenly stopped working in a not-so-graceful way.  I have 3 instances of LoadData in my OnStart that look for a specific setting and have the optional "true" at the end in case nothing is there. 

 

2 of them work just fine, but a 3rd one I have called "locationSetting" does not work at all, and does not throw any error.  It just bricks the entirety of the OnStart formula and causes nothing that was supposed to happen there to work. 

 

I've narrowed it down to the LoadData for this specific one by replacing it with a manual definition of the collection I was trying to load.  It doesn't work when it's both not there and has data stored under that collection name in the cache.

 

Here is the code I have in the OnStart:

LoadData(locationSetting,"locationSetting", true); <-the line breaking the code
Set(SelectedLocation,LookUp(locationSetting, Setting="Location",Location));
If(IsBlank(SelectedLocation),Set(SelectedLocation,"All"));

 

Not sure if there are any banned words that I can't use for my locally saved collections, limits to the number of times I can call LoadData, or if I should delay/stagger all the LoadData calls by a small margin with a timer, since other than that, I'm stumped on how to fix this.

Categories:
  • Saksham2003 Profile Picture
    Microsoft Employee on at

    In your case, LoadData(locationSetting,"locationSetting", true);, it seems like you’re trying to load data from a file named “locationSetting” into a collection named locationSetting. If this line is causing an error, here are a few things you could check:

    1. File Existence: Make sure the file “locationSetting” exists and is accessible.
    2. Collection Existence: Ensure the collection locationSetting has been initialized before this function call.
    3. Data Format: Check if the data in the file is in the correct format that PowerApps expects.
  • nickzav Profile Picture
    4 on at

    Hi Saksham2003,

     

    Thanks for getting back.

     

    Sorry for not clarifying more, but my goal with this is to properly handle when the collection has not been created yet, for example, on a user's initial launch of the application, along with when it is already created.

     

    The same issue where the entirety of OnStart stops working without showing an error message/red squiggly line occurs whether or not that file had been created in a previous session, so I'm not sure if there's an issue with Power Apps itself, or if I'm doing something wrong.  I've also tested out manually creating a collection instead of the LoadData() call, so I'm not sure if there's a formatting issue, since I copied the exact ClearCollect() I use when I initially upload the file.

     

    What's perplexing about this issue is that it only occurs with this LoadData.  When I comment the LoadData() for the locationSetting out of the OnStart, everything runs smoothly as expected, including the other 2 LoadData() calls I have.  However, when I add the third locationSetting one back in, even after changing the name of the collection and file, it silently breaks again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard