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 / Patching Update of mul...
Power Apps
Unanswered

Patching Update of multiple lines of data to sharepoint list

(0) ShareShare
ReportReport
Posted on by 122

Hi 

 

I am trying to update 3 columns relating to potentially multiple lines of source data within a sharepoint list. Below is a screenshot of the gallery for which the source data is a collection (checkedrow). 

Massingc1983_0-1683126702519.png

Using the "Confirmed Received" button i am updating the collection to a new collection called (CollGRNUpdate) using the 3 dropdowns. From here i want to patch my source data list "Requisition Line Item" with an update where the "Item Number" matches the "ItemNumber" in my collection (CollGRNUpdate). I have come up with the below code but it doesn't appear to be working. 

 

ClearCollect(
CollGRNUpdate,
{
ItemNumber: Label25.Text,
GRNStatus: ddGRNStatusUpdate.SelectedText,
ReceivedBy: ComboBoxGRNUpdateReceivedBy.Selected,
DeliveredDate: DatePickerdeliveredDate.SelectedDate
}
);

ForAll(
CollGRNUpdate,
Patch('Requisition Line Item',
LookUp('Requisition Line Item','Item Number' = CollGRNUpdate,ItemNumber),
{
'GRN Notice Confirmed': GRNStatus.Value,
'Received by': ReceivedBy,
'Delivered Date': DeliveredDate
}
);

Clear(checkedRow);

Set(VarGRNConfirmationReceived,false)

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

    Hi @Massingc1983 ,

    Try this

    Patch(
     'Requisition Line Item',
     ForAll(
     CollGRNUpdate As aCol,
     With(
     {
     wID:
     LookUp(
     'Requisition Line Item',
     'Item Number' = aCol.ItemNumber
     ).ID
     },
     {
     ID: wID,
     'GRN Notice Confirmed': aCol.GRNStatus.Value,
     'Received by': aCol.ReceivedBy,
     'Delivered Date': aCol.DeliveredDate
     }
     )
     )
    );

    I will offer some fundamental advice here that may assist with this and future ForAll() exercises. It is not designed to be a Loop, although it can work this way with considerable performance penalty as it does an individual Patch for each record. ForAll() creates a Table, which can be patched in one action provided its content is correct. For new records, this is simply a Table with field names and field types matching the list. For existing records, including the SharePoint record ID in the table causes it to update that record for each of the Table records.

     

    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

  • TonkaTrucks Profile Picture
    2 on at

    Hi @Massingc1983,

     

    If possible I would switch to an implicit save method. With that method, you would patch the specific column for the specific record OnChange of the control. With that, you wouldn't need to create a "Submit" button or collect a collection of updates.

     

    However, if you need an explicit save, I would use something like this for your saving action:

     

    ForAll(
     CollGRNUpdate As ItemToUpdate,
     Patch(
     'Requisition Line Item',
     LookUp(
     'Requisition Line Item',
     'Item Number' = ItemToUpdate.ItemNumber
     ),
     {
     'GRN Notice Confirmed': ItemToUpdate.GRNStatus.Value,
     'Received by': ItemToUpdate.ReceivedBy,
     'Delivered Date': ItemToUpdateDeliveredDate
     }
     )
    );

     

  • Massingc1983 Profile Picture
    122 on at

    Hi @TonkaTrucks 

     

    Thank you for you reply. I think i am nearly there however am getting an error within the patch section of the formula which says

     

    "Issue Invalid argument type. Expecting a Record Value but of a different schema."

     

    I am struggling to find a fix?

     

    Chris 

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @Massingc1983 ,

    Please tag me if you need me further - you might note my comment on ForAll structure - it is much quicker and more efficient.

  • Massingc1983 Profile Picture
    122 on at

    Hi @WarrenBelz 

     

    Thank you for your reply. I am not sure i fully understand the quote reference for all function. Or at least i am not sure how to apply it in this situation?

     

    thank you also for the code suggestion. I get the following error when applying it:

     

       "Issue - Invalid Argument type (table). Expecting a Record Value instead."

     

    I am not sure how to fix this. 

     

    Thank you for your help i will get there eventually!!

     

    Chris 

     

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @Massingc1983 ,

    Please see amended code.

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