Showing results for 
Search instead for 
Did you mean: 
Not applicable

Attempting to write a (toggle) value from a collection (derived from a Gallery) into a SQL database. Cannot figure out how to identify the record(s) to write to.

I have an EDIT screen with an EDIT form and a GALLERY at the bottom which brings back corresponding record(s) from a SQL database ('[shp].[MOBProductPO]_1'). The toggle within the gallery will be the only editable item wihtin the GALLERY. If the user swithes the toggle I need to be able to write back that value to the SQL Database.


So far the Submit button creates a Collection (POEdit) which holds the toggle values for each record in the gallery. 


What is the syntax to write those values back to their corresponding records within the SQL database? I can not figure out how to tell PowerApps which record.

Thas for any help


Community Support
Community Support

Hi @Anonymous ,

Do you want to update records in PowerApps to SQL?

I suggest you use the combination of gallery and edit form.

1)Set the gallery's Items: tablename

2)inset an "add" button

3)set the "add" button's OnSelect: NewForm(Form1)

4)Set the edit form's data source: tablename

                                  Item: gallery1.Selected

5)Set the submitform's OnSelect: SubmitForm(Form1)


Then, if you click the "add"button, the form will be an empty form, you could enter data in it.Cilck the submit button, you will create a new record to SQL.

If you click the arrow button inside tha gallery , the form will load the item's data that you select.You could edit the data. Click the submit button, you will update the record that you select to SQL.


Here's a doc about it for your reference:




Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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