Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Lookup and patch a form



I have 2 SharePoint lists - "Header" and "Details". Both lists have an ID column, which is the ID column auto-generated by SharePoint.


On the Header list, I have a column called "Total". On the Details list, I have a column called "Item". I want to patch whatever is entered in Details list Item Column onto Header list Total column. The referencing column would be ID where if both IDs match, execute the patch. 


May I know what is the right way to write the Lookup portion of the Patch formula? Have been stuck at it for a while, and getting various errors. 


Thank you!

Community Support
Community Support

Hi @elleeyl , 

Could you please share a bit more about the Patch formula you used in your app?

Do you want to auto-populate the Total column in Header List when you edit the "Item" column of a Details list record based on the ID column value?


I assume that you add a Edit form in your app to update the Detail List reocrd, is it true? I have made a test on my side, please take a try with the following workaround:

Set the OnSuccess property of the Edit form (EditForm1, which connects to your Detail List) to following:

'Header Lst',
LookUp('Header Lst', ID = EditForm1.LastSubmit.ID), /* <-- Find the specific record in Header list based on the matching ID column value*/
Total: EditForm1.LastSubmit.Item

please take a try with above solution, then check if the issue is solved.


More details about the Patch function and LookUp function, please check the following article:

Patch function, LookUp function


Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xida-msft ,


Thanks for your response. Let me try to explain what I'm trying to do better.


Let's say I have 2 SP list.

This is my SP list 1 /Powerapps Screen 1; let's call it Header. "TotalClaimAmount" and "ReportID" are number fields.


This is my SP list 2 /Powerapps Screen 2; let's call it Details. "ExpenseType" is populated by a dropdown box, "ExpenseAmount" and "ParentID" are number fields. 



The idea is that once I Patch the details in Screen 1, ReportID would be generated in SP, and I would be brough to Screen 2 to fill in the details. In Screen 2, I would enter what I bought and how much I bought that item for. ParentID column here would be the same as ReportID column in Screen 1, as long as it is under the same Header. Once I am done with all the expense details, I would click on a "Submit" button (on Screen 2) which would sum up all the expense items under the same ParentID, and populate the total sum under TotalClaimAmont in Screen 1.


I tried the below formula on OnSelect button in Screen 2


Set(expenseamount,Value(DataCardValue44.Text));  /* <-- this is the individual value entered in Screen 2 under expense amount

Set(reportid, Last(Header).ReportID);  /* <-- this is used to populate the report ID  in Screen 1 onto Screen 2 for each individual expense

Patch(Details, Defaults(Details),{ParentID: reportid, Title: DataCardValue37.Text, ExpenseType: DataCardValue43.Selected, ExpenseAmount: Value(DataCardValue44.Text)}); /* <-- this is used to patch the ParentID, expensetype and expenseamount onto Details/Screen2

Patch(Header, LookUp(reportid=Details.parentid), {xxxxxxxx}) /* <-- this is used to sum all the individual expense amounts under the same ParentID under Details/Screen 2 and patch the total amount back under TotalClaimAmount of the same ID in Header/Screen 1.


May I know how I should write the formula for the last part, i.e. the patch formula to sum all the individual expense amounts of the same ParentID back onto the header list with the same ID?


I tried writing one but am getting invalid argument error. Thanks for your advice. Trying very hard to get unstuck. 🙂

Hi, can anyone help me please? Thanks.

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (856)