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

Administrator
Administrator

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
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 175 members 5,509 guests
Please welcome our newest community members: