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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (96,780)