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 / Update gallery to sql
Power Apps
Answered

Update gallery to sql

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I have been trying to update all the data of a gallery. I'm using a SQL server to store all the data. 

The gallery is in this format:

image.png

I tried to update using the functions Update and UpdateIf, but I did not get the result I was expected.

Using UpdateIf  (condition: true -affecting all the table) all the records was updated to the last record.

Using Update I get a error id is needed, but when I add the ID another error shows saying id is generated by the server... (id is a PK from the table and is auto incremental)

Do you know how can I do to uptade the table?

Thank you for your time.

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    HI @Anonymous ,

    Do you want to update all data within your Gallery into your SQL Table via pressing a "Submit" button?

     

    Based on the needs that you mentioned, I think the Update() function and UpdateIf() function both could not achieve your needs.

    I think the combination of ForAll function and Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    Set the OnSelect property of the "Submit" button to following formula:

     

    ForAll(
     RenameColumns(Gallery1.AllItems, "id", "id1"), /* <-- id represents the primary key column in your SQL Table */
     Patch(
     '[dbo].[YourSQLTable]',
     LookUp('[dbo].[YourSQLTable]', id = id1),
     {
     Nombre: TextInput1.Text,
     Tipo: Dropdown1.Selected.Value,
     Capacidad: TextInput2.Text,
     Rendimiento: TextInput3.Text,
     CapacidadM3: TextInput4.Text,
     Armador: TextInput5.Text
     }
     )
    )

    Note: The TextInput1, Dropdown1, TextInput2, ... represents the corresponding controls within your Gallery.

     

     

    More details about the ForAll function and Patch function in PowerApps, please check the following article:

    ForAll function

    Patch function

     

    The user @Helen_BB has faced same issue with you, please also check the response within the following thread:

    https://powerusers.microsoft.com/t5/General-Discussion/Editing-multiple-records-in-a-gallery-help/m-p/152467

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, @v-xida-msft 

    It works!!

    Thank you

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard