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 / Patch, cant update 2 r...
Power Apps
Answered

Patch, cant update 2 rows in one table at same time

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a EditForm with 2 datasources from SQL tables. So when I click checkmark to submit, I should update 1 row in PaymentVaucher, and as many rows in table LineItems as there are curently on form. 

I have created a patch function for updateing data. But I can only submit 1 row to each tables at once.

I cant submit both rows to table LineItems at once. Why is that?

 

EditForm:

Screenshot_22.png 

 

OnSelect value for checkmark icon, for submiting data:

DataCardValue21 and Label14 have ID values of rows.

 

Patch('[dbo].[PaymentVaucher]', LookUp('[dbo].[PaymentVaucher]', ID = Value(DataCardValue21.Text)),
 
 {RequestedBy: DataCardValue29.Text,
 RequesterEmail: DataCardValue30.Text,
 PaymentDate: DataCardValue31.SelectedDate,
 DueDate: DataCardValue32.SelectedDate,
 AccountingApprovalComments: DataCardValue33.Text,
 Curency: DataCardValue39.Text,
 AccountingApproval: Radio1.Selected.Value
 }
);

Patch('[dbo].[LineItems]', LookUp('[dbo].[LineItems]', ID = Value(Label4.Text)),
 {Description: TextInput5.Text,
 Quantity: Value(TextInput6.Text),
 Price: Value(TextInput7.Text)
 }
)

 

Categories:
I have the same question (0)
  • Bilakanti Profile Picture
    1,226 on at

    @Anonymous ,

     

    LineItems, is a Gallery and it contains more than one item. Hence you need to us ForAll to iterate through each time in the LineItemsGallery and then apply your patch. Then it will patch all the rows from your Gallery.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I tried it like like this, but then I get for specified columns in table LineItems all rows updated with the same value 😬

    Patch('[dbo].[PaymentVaucher]', LookUp('[dbo].[PaymentVaucher]', ID = Value(DataCardValue21.Text)),
     
     {RequestedBy: DataCardValue29.Text,
     RequesterEmail: DataCardValue30.Text,
     PaymentDate: DataCardValue31.SelectedDate,
     DueDate: DataCardValue32.SelectedDate,
     AccountingApprovalComments: DataCardValue33.Text,
     Curency: Dropdown7.Selected.Curency,
     AccountingApproval: Radio1.Selected.Value
     }
    );
    
    ForAll(RenameColumns('[dbo].[LineItems]', "ID", "eID"), Patch('[dbo].[LineItems]', LookUp('[dbo].[LineItems]', ID=eID),
     {Description: TextInput5.Text},
     {Quantity: Value(TextInput6.Text)},
     {Price: TextInput7.Text}
     ))

     

  • Verified answer
    Bilakanti Profile Picture
    1,226 on at

    @Anonymous ,

    Please do ForAll for GalleryName.AllItems, for Description and other columns, instead of passing control values, pass the column names. Below is the same syntax.

    ForAll(GalleryX.AllItems, Patch('[dbo].[LineItems]', LookUp('[dbo].[LineItems]', ID=eID),
     {Description: Description}//which will be column name from Gallery Items,
     {Quantity: Value(Quantity)}//which will be column name from Gallery Items, ,
     {Price: Price}//which will be column name from Gallery Items,
     ))

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard