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

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
Highlighted
Community Support
Community Support

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 III
Super User III

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})

 

Highlighted
Community Support
Community Support

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

Highlighted
Anonymous
Not applicable

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,

 

@Anonymous 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

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,368)