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 bulk records wi...
Power Apps
Answered

Update bulk records with ForAll is not working in SQL

(0) ShareShare
ReportReport
Posted on by 162

Hi,

i am doing simple operations. Editing gallery textinput fields and when i change value there it adds new value to _supplyTemp temprary collection.

then i want iterate through this collection and update bulk records on azure sql.

 

i use below code, but no one record are updated. what is wrong there?

 

 

ForAll(
 _supplyTemp;
 Patch(
 '[dbo].[Tiekimas]';
 LookUp('[dbo].[Tiekimas]';
 Id = _supplyTemp[@Id];
 {
 Id: Id;
 UzsakymoId: _orderId; 
 Rusiavimas: Rusiavimas;
 TiekimoKategorijosId: TiekimoKategorijosId; 
 Aprasymas: Aprasymas;
 Matas: Matas;
 Kiekis: Kiekis;
 Kaina: Kaina;
 Viso: Viso
 }
)));;
Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @opit 

    You appear to have a mistake in your formula, consider changing to this:

    ForAll(
     _supplyTemp;
     Patch(
     '[dbo].[Tiekimas]';
     LookUp('[dbo].[Tiekimas]';
     Id = _supplyTemp[@Id]); //<- Missing ending parenthesis here for your lookup
     {
     Id: Id;
     UzsakymoId: _orderId; 
     Rusiavimas: Rusiavimas;
     TiekimoKategorijosId: TiekimoKategorijosId; 
     Aprasymas: Aprasymas;
     Matas: Matas;
     Kiekis: Kiekis;
     Kaina: Kaina;
     Viso: Viso
     }
    )));; //<- remove extra paren here

    I hope that is helpful for you.

  • opit Profile Picture
    162 on at

    I fixed mistake, but it was not solved issue, records to SQL database are not saved.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @opit 

    Also consider removing the Id: Id; assignment from your record.  You are altering an existing record that already has an Id, there is no need to reassign that value and in some cases, can cause the record to not get updated.

    If that is still not helping, try to reduce down the section of the formula that is causing the issue.  So, for example, try to execute the contents of your ForAll (the Patch statement) separately in someplace like a button.  Replace the Lookup Id=_suppllyTemp[@Id] with a known value - Id=1 for example.

    See if your Patch statement is working properly outside of the ForAll.  Then, if not - fix that issue.  If so, then proceed to diagnose the issue from within the ForAll.  Review your collection in the collection viewer and make sure that it has the columns and values that you expect.

  • Verified answer
    opit Profile Picture
    162 on at

    thanks for support.

    but i solved my issue following:

    When edited gallery TextInput fields i did gallery data source edit

    Patch(_supply;ThisItem;{Aprasymas:TextInputAprasymas.Text})

    And then i make just use patch, because in this way galery data source and database table are similar:

    Patch('[dbo].[Tiekimas]';_supply);;

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
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard