cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate IV
Advocate IV

Components - work around no data source access

I'm writing an app that requires offline capability. As such, in places where data should be saved to the data source, the connection status is checked. If there's no connection, changes are saved to a local buffer, to be saved later.

 

I'm working on the 'saving later' part now. I really want this to be done from any screen, but since there may be multiple buffers I don't want to be copy/pasting a lot of save code all over my app (can you spell 'maintenance horror?' 😉 )

 

That's why I tried using a component, as it's easy to add to any screen and it provides a central place for the save code. The component consists of a label that is visible if any save buffer contains data, and a timer that will take care of checking connection and sending the data when it can. But I'm now running into what I think is listed as a known limitation: "data sources aren't saved with components, so forms and data tables are disabled". The code doesn't recognize the datasource in my Patch( datasource, ... ) code...

 

Is there any smart way to work around this limitation? As I stated, I really, really don't want to be copy/pasting the same code all over, and while I could write a separate 'flush all buffered data' screen that I could let the user navigate to, that would be really interrupting a natural flow throughout the app.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Components - work around no data source access

Hi @MrNappa ,

Do you want to execute the Patch formula within your Component control?

Do you want the data source could be recognized within your Component control?

 

It is an known limit with Component control in PowerApps. The data source you added in your app could not be recognized within the Component control.

 

If you want to execute the Patch formula within your Component control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

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

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Components - work around no data source access

Hi @MrNappa ,

Do you want to execute the Patch formula within your Component control?

Do you want the data source could be recognized within your Component control?

 

It is an known limit with Component control in PowerApps. The data source you added in your app could not be recognized within the Component control.

 

If you want to execute the Patch formula within your Component control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

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

View solution in original post

Highlighted
Advocate IV
Advocate IV

Re: Components - work around no data source access

Yes, ideally I want the Patch command to the datasource to be executed from the component. As I described in the scenario, this would allow me to use the component in every screen to send buffered data once the connection is online. As opposed to duplicate this code everywhere.

 

Admittedly, trying to centralize my buffer saving code in a component is already a bit of a hack, because there is no way of doing so in some kind of background process.

 

I know it is currently a limitation (I included a link to the relevant documentation earlier, but a bot marked that post as spam), that's why I was wondering if someone would have thought some kind of clever way to work around this.

I'll post this to the ideas section too, but I won't get my hopes up 😅.

Highlighted
Advocate IV
Advocate IV

Re: Components - work around no data source access

Seems like nobody has a hack, so I'll just mark your reply as 'answer'. Thanks for thinking with me.


Idea post I made for reference and great justice:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Allow-access-to-data-source-from-within-componen...

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Components - work around no data source access

If I were you I would skip the component altogether and just use the new Select() function!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,809)