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 Bulk Update dif...
Power Apps
Answered

How to Bulk Update different textinput values passed inside gallery and patch it to the SQL/Oracle server ?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, 
I am new to Power Apps, 
I am trying to create an Excel-like editable gallery in Power Apps (as shown in the Screenshot),
PAPP COMM 1.PNG

 









When I try to enter three different scores for individual names (using Textinput input inside a vertical Gallery) and patch them to SQL server table using SAVE button, only one record (Score) is getting updated at a time in the SQL server table, I am unable to Patch multiple records (Scores) edited in the Gallery at a time using a Single BUTTON. 
Is it possible to update multiple records at a time with different values using a single BUTTON?
I have seen several articles but could not find an appropriate solution. Please help me with this. 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

    Can you please share your code on the 'Save' button

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @Eelman, 
    Here is the code behind my SAVE button,
    OnSelect: Patch('dbo.STUDENT_TBL','EXCEL TYPE EDIT GALLERY'.Selected,{SCORE:Value('TextInput1'.Text)})


  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

    Thank-you. I should've also asked for the Items property of your gallery but I'll assume it is either a 'live' copy of your database OR a collection whose schema matches your database? If so, something like this should work:

     

    ForAll(RenameColumns('EXCEL TYPE EDIT GALLERY'.AllItems,"ID","ID1"), 
     // here I've assumed you have a column called ID, adjust this to suit your needs 
    
     Patch('dbo.STUDENT_TBL',
     LookUp('dbo.STUDENT_TBL', ID = ID1), // adjust ID & ID1 to your needs as per above
     {SCORE:Value('TextInput1'.Text)}
     )
    )

     

    Let me know how this goes.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @Eelman, 
    Thank You, This works great !!!
    Its a live connection of Database 🙂 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    No worries, happy to help 🙂 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @Eelman,

    The Code that you mentioned is getting the job done but looks like code is looping around for every record which includes records that are not being edited. This is taking more time than expected for the Power App to replicate the changes to the data source. Can you please help me in enhancing the code (looping process) that you have mentioned by patching only the edited items? 

    Thank you.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

    Your first image shows a Dropdown that filters the gallery, are you still using this? My thoughts are that if the gallery is filter first then apply the Patch() the function won't take a long time to run. Can you try this?

     

    If this filtering isn't an option you want for your users then we will have to work on other gallery filtering that suits your needs.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Eelman,
    Yes, I am filtering the Gallery first and I have many scores to edit (Let's say 500 records) after filtering the gallery. The code is looping for each filtered record in the gallery. For Instance, I have edited any 10 records of the 500 Rows of the filtered gallery, the code is looking up all the 500 records and Patching all the 500 records instead of only considering the 10 edited records)

    Is there a way that we can First filter the table (SQL Server table) that we are going to patch to get the IDs of that 10 edited records and then patch those 10 edited records back to the source(SQL Server table) instead of looping all the 500 records? This would help us in enhancing App performance. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

    Ah, ok.

     

    I was able to get something working at my end by adding a Toggle to the Gallery. Try this:

     

    1. Add a Toggle to the Gallery

    2. Set the Toggle Default to

    If(TextInput1.Text=ThisItem.Score,false,true)

    Notes: 

    - TextInput1 is the input field you are adjusting the score inside your gallery

    - ThisItem.Score, change 'Score' to match your DB column heading

    - you can hide this Toggle when we are done, set the Visible property to false

     

    3. Adjust your Patch code to this

    ForAll(RenameColumns(Filter('EXCEL TYPE EDIT GALLERY'.AllItems,Toggle1.Value),"ID","ID1"), 
     // here I've assumed you have a column called ID, adjust this to suit your needs 
    
     Patch('dbo.STUDENT_TBL',
     LookUp('dbo.STUDENT_TBL', ID = ID1), // adjust ID & ID1 to your needs as per above
     {SCORE:Value('TextInput1'.Text)}
     )
    )

    Note: Toggle1 is the name of your Toggle so adjust as needed.

     

    Let me know if this improves the performance?

     

     

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard