cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Frequent Visitor

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
Highlighted
Community Support
Community Support

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
Frequent Visitor

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,923)