cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Screen Datasource Pre-Loading Behaviour

Would be interested to know if there is any information available on the conditions when a PowerApp attempts to retrieve data from a data source. Based on my scenario below, it appears that the datasources within a screen are triggered (start trying to retrieve data) when a button is selected that contains a command to navigate to that screen, even though the navigate is inside an If statement and so the navigation may not occur.

Scenario

My App has offline and online mode. There are some screens where galleries display data either from the offline (local collection) datasource or the online datasource (in this case Dynamics 365 CE) depending upon connection state.

Initially I had an If statement within the Gallery Items property:

If(Connection.Connected Or Connection.Metered, 
Filter(Accounts, Account = .., 
Filter(colAccounts, Account = ...)

However, the App was attempting to read data from the Dynamics Account entity even when the App was in offline mode (resulting in an error).

I therefore created two separate screens, one for offline and one for online. I then put an If statement on the button that calls the screens:

If(Connection.Connected Or Connection.Metered,
Navigate('Select Account',Cover,{conSelectedAccount:conSelectedAccount}),
Navigate('Select Account Online',Cover,{conSelectedAccount:conSelectedAccount}))

Even with this, when the button was pushed in offline mode, the App was still attempting to read data from the Dynamics Account entity (resulting in an error).

Finally I put two buttons on the screen - one to navigate to the screen with the gallery based on the offline data and one to navigate to the screen with the online data. I then set these buttons to be visible depending on the connection state and finally I can prevent the App from trying to retrieve data from the online source while the App is offline.

Some info on exactly what circumstances result in an App attempting to read data would be appreciated.

2 REPLIES 2
seadude
Level 10

Re: Screen Datasource Pre-Loading Behaviour

Hm... Interesting.

Gut feeling is that its one of the settings in AppSettings/Advanced Settings.

 

  • Have you set any of these from Default?
  • If not, should you?

I can't answer the 2nd one, but IIRC there are a few in there that "Optimize" things. One of these optimizations may be to see what data sources your app has and Pre-fetch them... just a guess.

 

Very interested to see what you find.

Community Support Team
Community Support Team

Re: Screen Datasource Pre-Loading Behaviour

HI @PaulD1 ,

Thanks for sharing your idea. That's an interesting phenomenon.

For now, I haven't found any doc about this.

If I find anything about it, I will reply here.

 

Best regards,

Community Support Team _ Phoebe Liu

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 51 members 3,430 guests
Please welcome our newest community members: