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

Error using Patch

Hi,

 

I have a PowerApp that will ultimately be embedded into a PowerBI page. The app is linked to a Sharepoint List and I need to write back to the list and to update a single number field (Headcount). I have a gallery page with all the fields from the PowerBI data and a text insert box with the Headcount set as default.

 

The save button I have added as the following OnSelect code but I get an error saying the Patch function has some invalid arguments. 

 

Patch('SNP Power Apps Proposed Data',
Gallery1.Selected,
{Headcount: Value(UpdateNumber.Text)})

 

Any thoughts on what I have done wrong please?

1 ACCEPTED SOLUTION

Accepted Solutions
Nogueira1306
Community Champion
Community Champion

Patch('SNP Power Apps Proposed Data',
LookUp('SNP Power Apps Proposed Data', ID = Gallery1.Selected.ID),
{Headcount: Value(UpdateNumber.Text)})

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

View solution in original post

3 REPLIES 3
Nogueira1306
Community Champion
Community Champion

Patch('SNP Power Apps Proposed Data',
LookUp('SNP Power Apps Proposed Data', ID = Gallery1.Selected.ID),
{Headcount: Value(UpdateNumber.Text)})

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

View solution in original post

arkroyal
Frequent Visitor

Thanks for the help - I've made the change as suggested but I'm now getting two different error messages.

 

Name isn't valid. This identifier is not recognized.

Incompatible types for comparison. These types can't be compared: Number, Error.

 

Any idea?

arkroyal
Frequent Visitor

Managed to sort it. The look up couldn't find the ID. I have used Lookup and the And function to find each specific record.

 

Thanks for your help Gonçalo Nogueira - it put be on the right track!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,086)