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 Apps
Unanswered

Patch function

(0) ShareShare
ReportReport
Posted on by 43

Hi 

 

I have a PowerApp that is an Inventory system in which you can 'check out' items and then you are able to 'Check in' the notes back and works off 2 SharePoint lists.

 

I have written a patch function which allows the user to check in less items than originally checked out.

With(
{
SharedItemToPatch: LookUp(
Notes,
ID = varRecord3.ItemBorrowed
)
},
Patch(
Notes,
SharedItemToPatch,
{ TotalCheckedIn: Dropdown3.Selected.Value,
TotalCheckedOut: SharedItemToPatch.TotalCheckedOut - (varRecord3.TotalCheckedOut-Dropdown3.Selected.Value)
}
)
);
Patch(
'Note List log',
varRecord3,
{
Status: "Returned",
DateActualReturned: Today(),
TotalCheckedOut: (varRecord3.TotalCheckedOut-Dropdown3.Selected.Value),
TotalCheckedIn: Dropdown3.Selected.Value
}
);

 

The issue I am having is that when I check in the 2nd Patch function works perfectly and the Check Out column decreases but I can not replicate this on the first function.  It never decreases properly.

 

Can anyone help as this is driving me insane

 

Thanks 

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

    Hi @alex_murphy ,

    Firstly, I do not know your logic here, but firstly I suggest the below for the first part of each to be more specific on the record - also note the change in the drop-down.

    With(
     {
     SharedItemToPatch: 
     LookUp(
     Notes,
     ID = varRecord3.ItemBorrowed
     )
     },
     Patch(
     Notes,
     {ID: varRecord3.ItemBorrowed},
     {
     TotalCheckedIn: Dropdown3.Selected.Value,
     TotalCheckedOut: SharedItemToPatch.TotalCheckedOut - (varRecord3.TotalCheckedOut - Value(Dropdown3.Selected.Value))
     }
     )
    );
    Patch(
     'Note List log',
     {ID: varRecord3.ID}, 
     {
     Status: "Returned",
     DateActualReturned: Today(),
     TotalCheckedOut: (varRecord3.TotalCheckedOut - Value(Dropdown3.Selected.Value)),
     TotalCheckedIn: Dropdown3.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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    Hi @alex_murphy ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

  • AlexMurphy Profile Picture
    43 on at

    Hi @WarrenBelz 

     

    Sorry for not replying. what you should be didn't quite worked but as soon as I took off SharedItemtoPatch on the first Patch function it did.

     

     

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard