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

Save & Load variable

Hi!  
I need my app to save a value (false) when it's offline. The app will close. Once opened again the app this value must be loaded and change the "visible" property of the buttons to "false". (visible = varGespeichert)

firefox_2019-03-26_13-03-28.png

 

I save the variable using..firefox_2019-03-26_12-43-32.png

 

I initialize the variable so that, in case there are no saved data, the buttons are visible 
firefox_2019-03-26_12-59-09.png

 

firefox_2019-03-26_12-42-46.png

 

and to load the data and change the "visible" property I have used several formulas, for example:
      If(!IsBlank(VAsavedData); LoadData(VAsavedData; "isGespeichertFile"; true);;
      If(!IsBlank(VAsavedData); UpdateContext({varGespeichert: First(VAsavedData).varGespeichert});;

 

I can't get it to work. I would be very grateful for your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Juanfran
Level: Powered On

Re: Save & Load variable

Thank you very much for your answer @v-xida-msft!!

So I finally got it to work with the following code:


LoadData
(VAsavedData; "isGespeichertFile"; true);;
If(!IsEmpty(VAsavedData) && !IsBlank(VAsavedData); Set(varGespeichert;First(VAsavedData).varGespeichert))
 
Best regards,
Juanfran
2 REPLIES 2
Community Support Team
Community Support Team

Re: Save & Load variable

Hi @Juanfran ,

Do you want to save the global variable as a cached data within your PowerApps Mobile App?

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

When your app is offline, save your global variable as cache data using following formula:

Set(varGespeichert; false);;
ClearCollect(
                    VAsavedData;
                    varGespeichert
);;
SaveData(VAsavedData; "isGespeichertFile")

When you load the cached data into your app, please take a try with the following formula (Set the OnVisible property of the first screen of your app to following):

LoadData(VAsavedData; "isGespeichertFile"; true);;
Set(varGespeichert; First(VAsavedData).Value)

then you could use the global varGespeichert variable within your app.

 

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.
Juanfran
Level: Powered On

Re: Save & Load variable

Thank you very much for your answer @v-xida-msft!!

So I finally got it to work with the following code:


LoadData
(VAsavedData; "isGespeichertFile"; true);;
If(!IsEmpty(VAsavedData) && !IsBlank(VAsavedData); Set(varGespeichert;First(VAsavedData).varGespeichert))
 
Best regards,
Juanfran

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 190 members 3,760 guests
Please welcome our newest community members: