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

Bug: Patch updating NULL value in local collection does not work

Repro steps:

1)  ClearCollect(ValueList, SQLServer.TableA);

2)  Patch(ValueList, <Any item>, {NullValueColumn = 1});

3)  Check value on NullValueColumn, it will still be null.

 

However, if 2 were:
Patch(ValueList, <AnyItem>, {NonNullNumberColumn = 1});
it would work fine.  I have worked around this by updating the TableA view I'm using to have a value for NullValueColumn of IfNull(Value, 0), but this isn't always going to be an option, especially if pulling directly from a table rather than from a view.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Bug: Patch updating NULL value in local collection does not work

HI @aabrin ,

Do you want to use Patch function to update a column which has a blank value within a Collection?

 

It is a known issue that, when using Patch function to update a column which has a blank value within a collection (collect data from a SP list), the new value would not updated into the column.

The user @ChadVKealey has faced same issue with you, please check my response within the following thread:

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

 

On your side, please consider take a try to enable the "Formula-level error management" option within Advanced settings of App settings of your app, re-publish your app and re-load it, then try your Patch formula again, check if the issue is solved:1.JPG

 

In addition, you could also consider take a try to achieve your needs using UpdateIf function instead of Patch function:

UpdateIf(
ValueList,
LookUp(ValueList, PrimaryKeyColumn = "A specific value"), /* <-- Use LookUp formula to find the specific record you want to update */
{NullValueColumn = 1}
)

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

More details about UpdateIf function, please check the following article:

UpdateIf function

 

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

3 REPLIES 3
Highlighted
Super User
Super User

Re: Bug: Patch updating NULL value in local collection does not work

Hi @aabrin 

Yes, updating NULLs in local collections is a problem.

This thread here provides a bit more detail.

https://powerusers.microsoft.com/t5/General-Discussion/Patch-not-updating-on-null-values-in-database...

You can use the UpdateIf function in PowerApps to carry out what you're doing in your View, so this technique would work when you're retrieving data directly from tables.  After calling ClearCollect, you would use:

UpdateIf(ValueList, IsBlank(NullValueColumn), {NullValueColumn :0})

 

Community Support Team
Community Support Team

Re: Bug: Patch updating NULL value in local collection does not work

HI @aabrin ,

Do you want to use Patch function to update a column which has a blank value within a Collection?

 

It is a known issue that, when using Patch function to update a column which has a blank value within a collection (collect data from a SP list), the new value would not updated into the column.

The user @ChadVKealey has faced same issue with you, please check my response within the following thread:

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

 

On your side, please consider take a try to enable the "Formula-level error management" option within Advanced settings of App settings of your app, re-publish your app and re-load it, then try your Patch formula again, check if the issue is solved:1.JPG

 

In addition, you could also consider take a try to achieve your needs using UpdateIf function instead of Patch function:

UpdateIf(
ValueList,
LookUp(ValueList, PrimaryKeyColumn = "A specific value"), /* <-- Use LookUp formula to find the specific record you want to update */
{NullValueColumn = 1}
)

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

More details about UpdateIf function, please check the following article:

UpdateIf function

 

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

TopShelf-MSFT
Level 10

Re: Bug: Patch updating NULL value in local collection does not work

Thanks for posting in the community @aabrin - can you review the above replies and update the thread if they were helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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