cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Working Offline and Saving Later

Hi All - 

 

I know there have been some threads about saving an application while offline, however, I am still slightly confused with the best approach. 

 

To give some context, I am creating a tablet app that will be used in a hospital ward in Malawi Africa. A doctor will be inputting information as he sees a patient and will have no internet connection. Can someone recommend the best way to have it saved on the tablet until a connection to the internet is available. At that time it can then be synced back to the SharePoint list? 

 

If this is not possible, does anyone have any other recommendations?

 

Thank you!

Brandon 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Working Offline and Saving Later

Hi BKlyn,

 

I assume that it might be possible.


Please take this documentation for a reference:
https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/


To create a SharePoint offline app, firstly, you may need to load the data on the startup of the app.
Please try to set the screen’s OnVisible property likes following:

If(Connection.Connected,ClearCollect(localtest,List1.Title);UpdateContext({statustext:"Online data"}),LoadData(localtest,"local",true);UpdateContext({statustext:"local data"}));LoadData(localtesttopost,"local",true);SaveData(localtest,"local")

 

Secondly, you may need to add a button to save the new item to the data source.
Please try to set the button’s OnSelect property likes following:

If(Connection.Connected,Patch(List1,Defaults(List1),{Title:TextInput1.Text}),Collect(localtesttopost,{localTitle:TextInput1.Text});SaveData(localtesttopost,"local"))

 

Last, according to the documentation, we may try to add a Timer control to auto save the data pending in a collection to the list. At here, you may consider to use the ForAll function.
https://powerapps.microsoft.com/en-us/tutorials/function-forall/

If(Connection.Connected,ForAll(localtesttopost,Patch(List1,Defaults(List1),{Title:localTitle}));Clear(localtesttopost),Collect(localtesttopost,{localTitle:TextInput1.Text});SaveData(localtesttopost,"localtest"))

 

Please have a try with it. Hope this could be your reference.

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
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

3 REPLIES 3
Community Support Team
Community Support Team

Re: Working Offline and Saving Later

Hi BKlyn,

 

I assume that it might be possible.


Please take this documentation for a reference:
https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/


To create a SharePoint offline app, firstly, you may need to load the data on the startup of the app.
Please try to set the screen’s OnVisible property likes following:

If(Connection.Connected,ClearCollect(localtest,List1.Title);UpdateContext({statustext:"Online data"}),LoadData(localtest,"local",true);UpdateContext({statustext:"local data"}));LoadData(localtesttopost,"local",true);SaveData(localtest,"local")

 

Secondly, you may need to add a button to save the new item to the data source.
Please try to set the button’s OnSelect property likes following:

If(Connection.Connected,Patch(List1,Defaults(List1),{Title:TextInput1.Text}),Collect(localtesttopost,{localTitle:TextInput1.Text});SaveData(localtesttopost,"local"))

 

Last, according to the documentation, we may try to add a Timer control to auto save the data pending in a collection to the list. At here, you may consider to use the ForAll function.
https://powerapps.microsoft.com/en-us/tutorials/function-forall/

If(Connection.Connected,ForAll(localtesttopost,Patch(List1,Defaults(List1),{Title:localTitle}));Clear(localtesttopost),Collect(localtesttopost,{localTitle:TextInput1.Text});SaveData(localtesttopost,"localtest"))

 

Please have a try with it. Hope this could be your reference.

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
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

Anonymous
Not applicable

Re: Working Offline and Saving Later

This was perfect, thank you so much!

Anonymous
Not applicable

Re: Working Offline and Saving Later

Hi ,I need bit of help regarding offline mode using sharepoint , I have tried everything but the local cached data is not getting updated in sharepoint when the app is getting reconnected to internet , though it doesn't shows any errors. Offline data not getting updated in sharepoint. Below is my code, Pointer : When user is offline and trying to make a new entry his record is being saved in Collection "LocalUpdatedRecords" and when he regains the internet connectivity the records should be updated in sharepoint list "Offline test" .I have tried Using Patch ,Update ,Collect etc but nothing seems to update the records in sharepoint, any suggestions will be highly appreciated. Thanks in advance. If(Connection.Connected && CountRows(LocalUpdatedRecords)>0, ForAll(LocalUpdatedRecords,Patch(OfflineTest,Defaults(OfflineTest),{FirstName :lbl_FirstName,LastName:lbl_LastName,Age:lbl_Age,Mobile:lbl_Mobile})); Clear(LocalUpdatedRecords); SaveData(LocalUpdatedRecords,"LocalUpdatedRecordsToBeAdded"); Refresh(OfflineTest); ClearCollect(OfflineData2,OfflineTest); SaveData(OfflineData2,"LocalCachedData")); Navigate(BrowseScreen1,ScreenTransition.Cover)

Show less

 
 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,996)