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 / How to Update numeric ...
Power Apps
Answered

How to Update numeric table column using patch function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

 

I wanted to understand how to update a numeric column's value with its own value and value from another variable using patch function.

I have a variable NoofLeav with value of say 2. I want to update a column (NoofCasualLeaves) in EmpMaster table by subtracting value of NoofLeav with NoofCasualLeaves i.e. NoofCasualLeaves - NoofLeav

 

Below is my code:-

 

UpdateContext({NoofLeav: 5});

 

Patch(EmpMaster, First(Filter(EmpMaster, EmployeeID = EmpList.Selected.Result)), {NoofCasualLeaves: NoofCasualLeaves -NoofLeav})

 

This is not working.

 

Please help!!

 

Thanks in Advance,

 

Vishwas.

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can store the record that you want to patch in a variable, and from there you can access its current value for the NoofCasualLeaves property when using the Patch function:

    UpdateContext({ NoofLeav: 5 });
    UpdateContext({ RecordToPatch: LookUp(EmpMaster, EmployeeID = EmpList.Selected.Result) });
    Patch(EmpMaster, RecordToPatch, { NoofCasualLeaves: RecordToPatch.NoofCasualLeaves - NoofLeav })

    Hope this helps! 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @CarlosFigueira ,

     

    Thanks for the help. Yes this is working fine.

     

    Thnaks,

     

    Vishwas.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard