cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arozaki
Level: Powered On

Building offline functionality in PowerApps doesnt work

Hey there! I have an app which on app start executes the following code:  

If(Connection.Connected,
ClearCollect(temp, Entries);
LoadData(temp, "temporary",true)); 
SaveData(temp, "temporary");
LoadData(changes, "changesmade",true);

It basically put all data from the Entries CDS entity to a collection called temp and loads the data in the app, same as with the data coming from the changes cache.

My app has two screens: One screen called "Enter Data" which allows the user to input information in two text fields (one called AgeText and one called CaseText). When the user is done filling the text inputs and clicks on a icon I check if there is an internet connection, if yes I patch the data to the CDS entity "Entries" otherwise I save them temporarily in a cache as shown below:

If(Connection.Connected,
Patch(Entries,Defaults( Entries ), { 
Age: CaseText.Text, 
Casename: AgeText.Text
}), Collect(changes,{ 
Age: CaseText.Text, 
Casename: AgeText.Text
});
SaveData(changes, "changesmade")
); Navigate(DisplayData)

Afterwards I am being navigated to the DisplayData screen which has a gallery connected to the temp collection and a timer which checks every 5 minutes  if there is internet connection. If there is connection then it patches all the data from the changes collection to CDS and saves all entries of the CDS in the temp collection.

If(Connection.Connected,
ForAll(changes, Patch(Entries,Defaults( Entries ), { 
Age: Age, 
Casename: Casename}));
Clear(changes);
ClearCollect( temp,Entries );
SaveData( temp, "temporary" );
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Building offline functionality in PowerApps doesnt work

Hi @arozaki ,

Could you please share a bit more about your issue?

Do you mean that the cached data would not be loaded when you re-start your app?

Further, do you run your app in Mobile device or web browsers?

 

Based on the formula you provided above, I could not find any syntax error with it. Currently, the SavaData() function and LoadData() function are not supported within web browser, so you could not run your app in using web browser.

More details about the SaveData function and LoadData function in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata

 

If the cached data would not be loaded into your app when you re-start your app, please check if you have click the "Clear cache" option within your PowerApps Mobile App.

 

In addition, if you have some issues with the ForAll formula within your app, I mean that you could not use ForAll function and Patch function to patch changes into your Entries Entity, please consider modify the last formula you provided as below (set the OnTimerEnd property of the Timer control to following):

If(
Connection.Connected, ForAll(
changes,
Patch(
Entries,
Defaults(Entries),
{ Age: changes[@Age], /* <-- Modify here */ Casename: changes[@Casename] /* <-- Modify here */
}
)
); Clear(changes); ClearCollect( temp,Entries ); SaveData( temp, "temporary" ); );

More details about creating a Offline app in PowerApps, please check the following blog:

https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/

 

If the issue still exists, please consider re-create a new Offline canvas app based on above blog, then try your app within your Mobile device, then check if the issue is solved.

 

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.
1 REPLY 1
Community Support Team
Community Support Team

Re: Building offline functionality in PowerApps doesnt work

Hi @arozaki ,

Could you please share a bit more about your issue?

Do you mean that the cached data would not be loaded when you re-start your app?

Further, do you run your app in Mobile device or web browsers?

 

Based on the formula you provided above, I could not find any syntax error with it. Currently, the SavaData() function and LoadData() function are not supported within web browser, so you could not run your app in using web browser.

More details about the SaveData function and LoadData function in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata

 

If the cached data would not be loaded into your app when you re-start your app, please check if you have click the "Clear cache" option within your PowerApps Mobile App.

 

In addition, if you have some issues with the ForAll formula within your app, I mean that you could not use ForAll function and Patch function to patch changes into your Entries Entity, please consider modify the last formula you provided as below (set the OnTimerEnd property of the Timer control to following):

If(
Connection.Connected, ForAll(
changes,
Patch(
Entries,
Defaults(Entries),
{ Age: changes[@Age], /* <-- Modify here */ Casename: changes[@Casename] /* <-- Modify here */
}
)
); Clear(changes); ClearCollect( temp,Entries ); SaveData( temp, "temporary" ); );

More details about creating a Offline app in PowerApps, please check the following blog:

https://powerapps.microsoft.com/en-us/blog/build-offline-apps-with-new-powerapps-capabilities/

 

If the issue still exists, please consider re-create a new Offline canvas app based on above blog, then try your app within your Mobile device, then check if the issue is solved.

 

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.

Helpful resources

Announcements
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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 45 members 4,651 guests
Please welcome our newest community members: