web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to update a in SQL...
Power Apps
Answered

How to update a in SQL when it's modified in power apps?

(0) ShareShare
ReportReport
Posted on by 496

Hello everyone,

 

I hope all is well,

 

My Concern:

I would like to update rows in SQL when the user updates them in Canvas.

It could be on change of each item or onClick of the save button, all the items will be bulk updated.

 

What I have:

In SQL:

I have a table with a column Id as a primary key in SQL and other fields.

 

In Canvas:

I have a gallery where I inserted some Text Inputs and Comboboxes.

 

So how can I update theses records in order to reflect the changes in Canvas in the SQL table?

 

Amy help would be highly appreciated,

 

Regards,

 

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Roberto_el_Hajj 

    One way would be to use the OnChange property of each control in the grid

    Patch(yourtable, ThisItem, {field1:Textinput1.Text}) or 

    Patch(yourtable, ThisItem, {field2:ComboBox1.Selected} or ComboBox1.SelectedItems for multiselect

    To remove a record from the table put an "X"  icon in the gallery with OnSelect:

    Remove(yourtable, LookUp(yourtable, id = ThisItem.id))

     

     

  • RobHajj98 Profile Picture
    496 on at

    Thank you @Drrickryp for your reply,

     

    One more thing, if I would like to bulk delete all the existing records in a SQL table from Canvas by using one button, how can I achieve that ?

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Theoretically, RemoveIf(yourtable, id=id). The problem is RemoveIf is not delegatable in SQL so it will only remove up to your record limit. Also it requires a call for each record so it would be painfully slow with a large data set using PowerApps. I don't know of a work around so you may need to do it in SQL itself, or copy just the schema of your table to a new table  in SQL and use the copy in PowerApps. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard