cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to Update numeric table column using patch function

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: How to Update numeric table column using patch function

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! 

View solution in original post

2 REPLIES 2
Highlighted
Power Apps
Power Apps

Re: How to Update numeric table column using patch function

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! 

View solution in original post

Highlighted
Frequent Visitor

Re: How to Update numeric table column using patch function

Hi @CarlosFigueira ,

 

Thanks for the help. Yes this is working fine.

 

Thnaks,

 

Vishwas.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,780)