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

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
Anonymous
Not applicable

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
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

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.
Anonymous
Not applicable

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,045)