Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Use a toggle to change a field



I want to add a Toggle to change a field from Y to N.

I'm new to PowerApps need some help filling all the necessary function fields


Accepted Solutions

I'm not exactly sure what you want to do but you would need to use the default property of the toggle. The usual is parent.default.

View solution in original post

Power Apps
Power Apps



do you mean changing the content of a Label from Y to N ?

in that case you can do that easily by changing the text rule of the label to something like this


If (Toggle1.Value, "Y", "N")

where Toggle1 is the name of the toggle control


 I want to use the toggle to change a data field in the data source from N to Y.



Hi @NigWatson,

Set Toggle properties

OnCheck - Patch(datasource,baserecord,{datafield:”Y”})

OnUncheck - Patch(datasource,baserecord,{datafield:”N”})

baserecord would be be something like LookUp(datasource, ID=Gallery1.Selected.ID) or 

LookUp(datasource, ID=ThisItem.ID) if the toggle was inside a gallery.

Thanks Drrickryp,


But I don't understand baserecord


Could you please explain  LookUp(datasource, ID=Gallery1.Selected.ID) ?

The patch function consists of three components: the datasource being patched,  the base record being edited and the item being changed. It would be helpful if you could post a screenshot of the screen where you are placing the toggle so I could better explain it to you.  If you want to visualize it imagine a spreadsheet that contains a Table, thats the datasource.  The row inside of the table is the base record and the field in that row is the datafield.  Please watch the You Tube about the Patch function to understand how it works. 

In your case, I want to use the toggle to trigger the Patch function and make the change you want in your datasource.  

Hi Drrickryp,

Here are shots of the App's edit screen and it's data source:








Ok, This looks like it could be from an app developed from an Excel spreadsheet, Is that correct?  If  you are using an edit form, then you won't need to use the Patch function.  Please post a screenshot where you mouse over the red x so that I could see the error message you are getting.

Yes, that's correct the app was generated from a speadsheet.

Here's the error message.


Ok get out of preview mode by hitting f5.  Then click on the card containing the toggle but not the toggle itself.  Open the dropdown box in the upper left hand side of the screen and find the Update property.  Please let me know what it says.  

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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