cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Splush
Level: Powered On

Problem using the Patch function

Hey,

Im having a problem with the patch function in the following OnChange field of a text input field.

 

Set(Ident;Value(TextInput1.Text))&&Set(Beschreibung;LookUp('ProGlove Game';ID=Ident;Beschreibung))&&Set(Titel;LookUp('ProGlove Game';ID=Ident;Titel))&&Set(Punkte;Punkte+LookUp('ProGlove Game';ID=Ident;Punkte))&&

Patch('ProGlove Game';Filter('ProGlove Game';ID=Ident);{Hit:true})

&&Reset(TextInput1)

 

Im trying to change the "Hit" flag of a sharepoint item. Its ID I type into the text input field.

The red marked function is giving me invalid argument errors.

Does anybody have an idea?

5 REPLIES 5
Splush
Level: Powered On

Re: Problem using the Patch function

Somehow it works when I put the function in a button and then let the text input field click it. Though then I loose focus of that field and cant continue writing. Does anybody have an idea how to restructure?

Dual Super User
Dual Super User

Re: Problem using the Patch function

Patch() works on a single record at a time.  So either switch out your Filter() for a Lookup or add First() to the outside of the Filter.  That will return one record instead of a collection of records. The collection is why you are getting the invald arguments.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Splush
Level: Powered On

Re: Problem using the Patch function

The First doesnt do anything. We have already tried that

Dual Super User
Dual Super User

Re: Problem using the Patch function

Then I would try Lookup.  The point is Patch won't work on a collection of records.  You need to pass it a specific record as the second parameter.  Filter will supply a collection of records even if its only a collection of one.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Splush
Level: Powered On

Re: Problem using the Patch function

We tried Lookup aswell, though like I mentioned above, the code works in a button but not in my text input field. I can trigger that button from that text input field but cant get the cursor back in it afterwards

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,986)