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

Saving Toggle Value in a Variable

I am needing to use a variable to store a toggle value.  The SharePoint list does not have a field for the toggle value, I am building a checklist type control using Custom Data Cards, that when all the criteria is met (using toggles) then the SharePoint field will update verifying that all steps have been completed.  Is there a way to do this in Power Apps?  Using the UpdateContext(Var, toggleName.Value) in the OnSelect and then in the OnCheck use Set(Var, true)?  - just need a way to store that value. 

1 ACCEPTED SOLUTION

Accepted Solutions

You can use the SaveData and LoadData functions to store a collection on a device between uses of the app. Use the SaveData before the app exits, the use LoadData when the app starts to retrieve it. You can use variables and the Concatonate function to create a unique name if needed. Just add an If(!IsEmpty function to see if the data exist when the app loads

View solution in original post

3 REPLIES 3
Drrickryp
Super User
Super User

Hi @lynnosler 

There is no way to store variable once the app is closed unless there is a field in the data source capable of retrieving the value.  It is possible to recreate it again if the values upon which it is based are fields in your data source and it can be calculated from them.

LooseChippings
Advocate II
Advocate II

Hi @lynnosler 

 

@Drrickryp (Marty Feldman: “I can't believe my eyes.” ...) is, of course, correct.  But you could put a true/false column in SharePoint such as 'Complete' and have an If() statement in your app which says If(toggle1 = true && toggle2 = true[....etc], Patch(SharePoint List, ThisItem, {Complete: true}).  Then you would have a permanent record of completed items?

You can use the SaveData and LoadData functions to store a collection on a device between uses of the app. Use the SaveData before the app exits, the use LoadData when the app starts to retrieve it. You can use variables and the Concatonate function to create a unique name if needed. Just add an If(!IsEmpty function to see if the data exist when the app loads

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,166)