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

Notifications

Announcements

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

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:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard