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

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (44,443)