cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Patch feature doesn't recognize column

I'm trying to update an existing record with a group of users who are added later. The Users column is a multi-line text field. I have in use in the app the list name, the ID of the previously created item in a variable, and a collection and a string of the users. What I don't have at use in the app is the actual Users column that I want to update. When I add the patch to my submit button, it says it doesn't recognize the column:

Patch('My List Name',{ID: Value(ItemID.Text)},['Users':AllItemsString])

I also tried it with UpdateIf, but then I get errors about improper use of the colon:

UpdateIf('My List Name',ID: Value(ItemID.Text),{Users:AllItemsString})

I'm sure my syntax is wrong, but from what I found online through Microsoft and through other questions posted to the community, it looks right. Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Re: Patch feature doesn't recognize column

GOT IT!! Yes, the Patch feature is hugely useful and powerful and yes, insanely complicated to understand. After a bit of trial and error:

Patch('My List Name', LookUp('My List Name',ID=Value(ItemID_1.Text)),{Users:AllItemsString})

Note the subtle differences. This is working and I am thrilled! Thank you @Drrickryp

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Patch feature doesn't recognize column

Hi @ACPBSCi 

Typically, patch syntax has three parts, the datasource being patched, the record being patched and the fields being patched. 

 

Patch(Datasource, Lookup(Datasource,ID=Gallery1.Selected.ID),{Field1:Dropdown1.Selected.Value,Field2:Datepicker1.SelectedDate,Field3:TextInput1.Text, etc})

 

In the event that a new item is being added, then the second element is  changed to Defaults(Datasource) to indicate that this is a new item that is using the default fields. 

 

Patch(Datasource, Defaults(Datasource),{Field1:Dropdown1.Selected.Value,Field2:Datepicker1.SelectedDate,Field3:TextInput1.Text, etc})

 

The fields use a colon to indicate the name of the field (column) and where the data is coming from. Commas separate the fields.  and all of the fields are enclosed in curly braces.


Patch is one of the most versatile PowerApps functions but it is also very confusing to new developers. ref https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch 

 

For more information on Patch and SharePoint complex column types, see https://www.c-sharpcorner.com/article/powerapps-patch-fuction-with-complex-columns/ 

 

Highlighted
Helper II
Helper II

Re: Patch feature doesn't recognize column

I'm still getting errors. I have entered this:

Patch('My List Name', Lookup('My List Name',ID=ThisItemInfo_1.ItemID_1.ID),{Users:AllItemsString})

and I get the following errors:

  • The = in gives an error of "invalid argument type"
  • The .ItemID_1 gives an error of "Name isn't valid. This identifier isn't recognized."
  • The .ID gives an error of "Invalid use of ' '."

".ItemID_1" is a label. Is that the issue? I couldn't figure out how to get the actual ID field into my gallery, it only seems to let me add labels. So I added a label, had it display the ID for the current item, then save that ID to a variable for use later on. Do I need the actual ID field in order to make this work? Can I use the variable instead?

Highlighted
Helper II
Helper II

Re: Patch feature doesn't recognize column

GOT IT!! Yes, the Patch feature is hugely useful and powerful and yes, insanely complicated to understand. After a bit of trial and error:

Patch('My List Name', LookUp('My List Name',ID=Value(ItemID_1.Text)),{Users:AllItemsString})

Note the subtle differences. This is working and I am thrilled! Thank you @Drrickryp

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

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

Top Solution Authors
Top Kudoed Authors
Users online (6,360)