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

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

@Laura

1 REPLY 1
Highlighted
Community Support
Community Support

Re: 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.

Hi @Cmagee2433 ,

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:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-forms

 

 

 

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

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,976)