cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Station1901
Level: Powered On

Toggle switch that updates sharepoint

I have a toggle switch in a gallery which is simply ON or OFF.  If it is ON I would like it to update a sharepoint list Yes/No field (named NoRota) with YES and if it is OFF I would like the Yes/No field to change to NO.  The gallery sees the Sharepoint list (named CARS) as it is reading in information from there.

 

This sounds like such a simple thing to do but I am still learning to create powerapps and I may also be overthinking it.  Any help or advice would be much appreciated.


Accepted Solutions
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

Glad you got it to work!

 

So, it sounds like the control needs to have it's Default property set to ThisItem.NoRota

 

Hopefully that works.

 

-Jamie


All Replies
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

I think I understand what you want..

 

The gallery displays a list and each item has a checkbox (toggle).  When the user clicks the toggle, you want the record/item to be updated in SharePoint?

 

For the Toggle.OnCheck property I would put:

Patch(SHAREPOINTLISTNAME, ThisItem,{NoRota:true})

For the Toggle.OnUncheck property I would put:

Patch(SHAREPOINTLISTNAME,ThisItem,{NoRota:false})

 

This may introduce a little performance hit depending on the number of records, because it makes a call to SharePoint each time a checkbox is un/checked.

 

I would also highly recommend @Shanescows's videos (available on the Community Video Gallery and his YouTube Channel)./

 

Specifically, he did a 3-part series on using PowerApps to replicate the "repeating tables" functionality of InfoPath (RIP).  I'm pretty sure he covers using galleries and patch to update records in one of those 3 videos.  And probably some others too.

 

Good luck and Happy Apping!

 

-Jamie

Station1901
Level: Powered On

Re: Toggle switch that updates sharepoint

JAMIEWR, Thanks for replying, that does work and does update my sharepoint list, thankyou. The problem I have now is that if I switch the toggle switch to the 'On' position it doesn't stay there. By default the switch is 'OFF', when I switch it to 'On' it updates my sharepoint list with the correct result but the switch then moves back to the 'Off' position. How do I get the toggle switch to stay in the position I set it at?
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

Glad you got it to work!

 

So, it sounds like the control needs to have it's Default property set to ThisItem.NoRota

 

Hopefully that works.

 

-Jamie

Station1901
Level: Powered On

Re: Toggle switch that updates sharepoint

It works perfectly now - Thank you. Another bit of knowledge gained
jamiewr
Level 8

Re: Toggle switch that updates sharepoint

So glad to hear it! -Jamie
Super User Rank
Super User

Re: Toggle switch that updates sharepoint

What is the default value for the toggle?

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training