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 2 tables to one ...
Power Apps
Answered

Patch 2 tables to one gallery

(1) ShareShare
ReportReport
Posted on by 88

Hello guys,

 

I am currently trying to patch two tables to one gallery where in that gallery i have labels and fields and i would like to store the same information in both of the tables, the first patch works perfectly as its uses the collection that is also the gallery data source, however when trying to patch the second collection its not working. If anyone can help me with this i would really appreciate it. 

 

Patch(
 IRSuppliesItems,
 ThisItem,
 {
 Quantity: Value(quantityInp.Text),
 UOM: uomInp.Selected.Value,
 DateRequired: dateInp.SelectedDate,
 SuppDetails: suppliesDesInp.Text
 }
);


Patch(
 POSuppliesItems, 
ThisItem,
 {
 DatePromised: dateInp.SelectedDate, 
 Deliverables: suppliesDesInp.Text, 
 NewQuantity: Value(quantityInp.Text),
 UOM: uomInp.Selected.Value,
 }
);

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,333 Most Valuable Professional on at

    Hi @nunuNMS ,

    The reference to ThisItem can only apply to the list that the Gallery or Form is connected to (I assume here IRSuppliesItems ). If you want to update an item in POSuppliesItems, you need to identify how that record relates to the current one you are referring to, so what common fields identify the matching record ?

  • nunuNMS Profile Picture
    88 on at

    Hello there, So basically yes thisitem is for the IRSuppliesItems, the thing is that gallery contains repeating fields and on the form submission it takes the last submitted IR ID from the form and this is the common field between the two tables

     

    this is how both how the collections are created:

    ClearCollect(IRSuppliesItems, {Quantity: "", UOM: "", DateRequired: "", SuppDetails: ""});
    
    Navigate(srcNewIRRequest, ScreenTransition.Fade);
    
    ClearCollect(POSuppliesItems, {
     DatePromised: "", 
     Deliverables: "", 
     ExpenditureType: "", 
     PrevQuantity: "",
     NewQuantity: "",
     NewUnitPrice:"",
     WBS: "",
     PO_ID: "",
     ProjectCode: "",
     UOM: "",
     Amount: "",
     IRRequestID: ""
    });

     and this is how the screen looks, the patch functionality is added to the button in the gallery that has the text click to save items info: 

    nunuNMS_0-1720499862493.png

    and for the form above it, it has this formula for the onSuccess

    ForAll(
     IRSuppliesItems,
     Patch(
     'IR Supplies Details',
     Defaults('IR Supplies Details'),
     {
     Quantity: Value(ThisRecord.Quantity),
     'Supplies Description': ThisRecord.SuppDetails,
     UOM: uomInp.Selected.Value,
     'Date Required': DateValue(ThisRecord.DateRequired),
     'IR Request ID': LookUp(
     'IR Requets',
     'IR Request Id' = Form3.LastSubmit.'IR Request Id'
     )
     }
     )
    );

     if you can assist me with this, i would really appreciate it  and thank you.

  • WarrenBelz Profile Picture
    155,333 Most Valuable Professional on at

    HI @nunuNMS ,

    OK - I am still not clear - can you please just supply the field names in POSuppliesItems and IRSuppliesItems that match.

  • nunuNMS Profile Picture
    88 on at

    Hello, sorry for the confusion, its the IR Request Id, that value for both of the tables is the same, and the fields that i should be able to store in both of the tables are Date Required, UOM, Quantity, and the Supplier Name, this is how they are named in the first collection, and in the second collection they're called Date Promised, UOM, NewQuantity, and deliverables respectively. Thank you for your help

  • Verified answer
    WarrenBelz Profile Picture
    155,333 Most Valuable Professional on at

    @nunuNMS ,

    Based on those two fields having the same name and identical content

    Patch(
     IRSuppliesItems,
     ThisItem,
     {
     Quantity: Value(quantityInp.Text),
     UOM: uomInp.Selected.Value,
     DateRequired: dateInp.SelectedDate,
     SuppDetails: suppliesDesInp.Text
     }
    );
    Patch(
     POSuppliesItems, 
     LookUp(
     POSuppliesItems,
     'IR Request Id' = ThisItem.'IR Request Id'
     ),
     {
     DatePromised: dateInp.SelectedDate, 
     Deliverables: suppliesDesInp.Text, 
     NewQuantity: Value(quantityInp.Text),
     UOM: uomInp.Selected.Value,
     }
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard