cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Highlighted
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

View solution in original post

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.
Highlighted
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

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 334 members 5,700 guests
Please welcome our newest community members: