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

Update Gallery Values & Patch back to SQL

Dear Community,


I'm just developing a powerapps solution and seeking for some help for the following requirement:


a) I'm having a Gallery to display filtered data from an Azure SQL Database (I have loaded a copy of the filtered data into a collection)

b) As you can see here within the screenshot I want to update some values:


(1st column shows original value, 2nd column is the checkbox with which the data record to be updated will be selected and 3rd column is the new value which should be patched back to the datasource)


c) the functionality by selecting the relevent record with the checkbox works really great

d) but what I want to achieve is that the data records (either within the collection or directly within the SQL DB) will be updated by the updated values within the 3rd column


Any Ideas how I can achieve this last step?




Continued Contributor
Continued Contributor

Not sure I understood the whole lot is set up, and how the data is structured on your database but something like this should do:


Patch('Table',Checkbox.Selected,{ColumnToBeUpdatedName: TextInputBox.Text})


This should update your SQL DB. If it doesn't fit your solution quite well, give me some more info about how you have your app set up.

Hello jbrit2020,


thanks, I've tried your formula but it did unfortunately not worked for me.


Let me try to rephrase it. Within my gallery I have 3 columns:

- Original Value

- Change Value?

- New Value



For some line items I want to update the original value and have therefore introduced the checkbox column. Once I activate the checkbox the box for the new value appears (3rd column). If I now enter a new value, for example 5000 for the 3rd line item I want to update my collection / sql database for all selected line items accordingly.


Hope this is clearer now?






On the box textboxinput that shows up when you click on the checkbox put this on OnChange:


Patch('Yourtablename',YourGalleryName.Selected,{ColumnToBeUpdatedName: TextInputBox.Text})

with some minor modifications I got this working, thanks!


However it would be more convinient to make an update of all selected rows in one go through trigger (like a click on a button). Might that be possible using the ForAll function? Something like Forall Checkbox1 = selected than Patch Value... ?

you can try creating a button and then do something like this on the OnSelect option:




worth a try



sorry but I'm still struggling to get this working properly. I followed also a video from Shane about this but still having some issues:




This is the formula I'm using:

ForAll(RenameColumns(Filter(colpos, IsChoosen), "ID", "EID"), Patch('MYSQLDB', LookUp('MYSQLDB', ID = EID), {bookval: orgvalue - newvalue}))


This works fine as long as I'm selecting only one line item. But as soon as I select more than 1 item basically the same value will be patched to all data records.


Any further ideas?







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.

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 (3,203)