cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bpark1409
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.

12 REPLIES 12

@PhilD 

Yes, without this feature turned on, it will not "blank" any columns.

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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I didn't realize this is in the "Experimental" Features section. It wouldn't seem very prudent to provision significant functionality dependent on the use of a feature  prefaced with the words, "These features might change, break, or disappear at any time". I guess I'll have to take your word for it 😞

 

 

@PhilD 

Be that as it may, we pretty much have that feature turned on in all the apps we do. Never an issue with it.  But, we rarely set a column to a blank value.  Instead we opt for all columns to have some default value when they are created.  If you take that approach, then you can avoid using the feature.  ex. if you have a numeric column, set default to 0.  If you need to to be "blank", set back to zero, zero is assumed to be empty.  But this is all highly dependent on your data and your process.

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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,390)