cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Unable to Patch Empty Fields in Collection created from a SharePoint List

Hi,

 

I have identified an issue with the Patch function - I wasn't sure if this is the correct forum to raise it with Microsoft, but I would be interested to know if anyone else has experienced the same problem and if there is somewhere else where I should be posting this to?

 

Summary

The issue is with using the Patch function to update an empty field in a Collection that was created from a SharePoint Online Custom list - The patch function is only able to update fields that were populated in the SharePoint list when the collection was created.

 

A workaround is to use the UpdateIf function.

 

Steps to reproduce the issues:

 

Create a SharePoint Custom List 'PatchTest' with the default 'Title' column and and additional single line of Text Column called 'TestCol'

 

List DefinitionList Definition

Create 2 items in the SharePoint list - One with the text column ('TestCol') populated and one with it left empty

 

 

List ItemsList Items

Create a blank PowerApp and Connect the SharePoint List as a Datasource

 

 

DataSource.png

 

Create a Collection in PowerApps using the SharePoint List

 

Put the following in the OnSelect Property of a button and use it to create the collection:

 

ClearCollect(colPatchTest,PatchTest)

Confirm the collection has been created:

 

Collection.png

 

Update the record with the Text Column ('TestCol') populated using Patch

 

Put the following in the OnSelect Property of a button and use it to update the first record:

 

Patch(colPatchTest,LookUp(colPatchTest,ID=1),{TestCol: "X"})

Confirm that the record has been updated:

 

Result1.png

 

Try to Update the record with the Text Column ('TestCol') empty using Patch

 

Put the following in the OnSelect Property of a button and use it to try to update the second record:

 

Patch(colPatchTest,LookUp(colPatchTest,ID=2),{TestCol: "X"})

 

Confirm that the record was NOT updated:

 

Result2.png

 

Workaround - Update the record with the Text Column ('TestCol') empty using UpdateIf

 

Put the following in the OnSelect Property of a button and use it to try to update the second record:

 

UpdateIf(colPatchTest,ID=2,{TestCol: "X"})

Confirm that the Record has been updated:

 

Result3.png

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @bpark1409 ,

It is an known issue with Patch function in PowerApps. The user @ChadVKealey has faced same issue with you, please check the response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Patch-Problem-Existing-data-updated-new...

 

As an alternative solution, please consider take a try to update your record using UpdateIf function instead of Patch function. Please modify your formula as below:

 

UpdateIf(
colPatchTest,
ID = 2,
{
TestCol: "X"
}
)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

12 REPLIES 12
Super User III
Super User III

@bpark1409 

This is an issue using the Patch function.  Use the UpdateIf function instead.

Take a look at this posting for some more information.

 

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Community Support
Community Support

Hi @bpark1409 ,

It is an known issue with Patch function in PowerApps. The user @ChadVKealey has faced same issue with you, please check the response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Patch-Problem-Existing-data-updated-new...

 

As an alternative solution, please consider take a try to update your record using UpdateIf function instead of Patch function. Please modify your formula as below:

 

UpdateIf(
colPatchTest,
ID = 2,
{
TestCol: "X"
}
)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @v-xida-msft,

 

Thanks for confirming that this is a known issue.

 

FYI - I included the use of UpdateIf as a workaround within my  original post.

 

Regards.

I've just spent a few hours diagnosing this problem and finally concluding it must be a bug in the Patch function.  A quick search confirmed my hunch. So thanks to all for posting both the issue and solution.

 

Hmmm ... Some 4 months on since this was raised and this is still a production bug! 😞

Power Apps
Power Apps

We believe we have fixed this issue with version 3.20051.16, available with the Frequent cadence in some regions such as Canada.  It will be rolling out to everyone soon.  Please give it a try and let us know if you still see an issue.

Responsive Resident
Responsive Resident

hi @GregLi  @bpark1409 

 

I have the same related issue can you please help on this as well if you can thanks sir 

 

Please see the link below 

 

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-Increase-value-by-1-number-ignore-if-... 

@GregLi 

 

This is most certainly not working for me... what is the expectation here? Are we supposed to now be able to update a collection or a SharePoint list row using Patch and revert a numeric column to be blank? I tried all the usual ways of doing this and could not achieve using a SharePoint number column, with no default value set (in SharePoint). Cannot set to Blank() or "".

@PhilD 

Yes, this works fine.

Make sure you have "Formula-level error management" feature turned on in your Advanced Settings.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Oh, okay, thanks @RandyHayes ... is this required for this feature to work? I will try that when I get a chance. Thanks for clarifying the expectation... I'll report back and confirm that this works after I turn this on and test.

 

 

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,246)