cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChadVKealey
Level 8

Patch Problem: Existing data updated, new data not written to collection

I'm having a problem with Patch. I have an App with a Collection that's being created from a SharePoint list (well, specific items from the list). I'm then rendering the collection in a gallery and using text input fields to display and update values from the collection. 

 

What I've found is that Patch seems to be working properly if the column has data in it, but if the column is blank, it is not writing new values into it. See this video for a more detailed demonstration of the issue: http://www.youtube.com/watch?v=G3MLsxT1DUY

 

This is the Patch statement I'm using: 

Patch(
col_SelectedOrderItems,
ThisItem,
{
OrderItemStatus: val_Status.Selected,
DrexFundNumb: Value(val_Fund.Text),
DrexOrgNumb: Value(val_Org.Text),
ShowSave: false
}
)

 

The columns DrexFundNumb and DrexOrgNumb are (in SharePoint) standard text (NOT number) columns, but the text input fields are set to allow only numbers.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Patch Problem: Existing data updated, new data not written to collection

Hi @ChadVKealey,

Just an update -- Response from @Corey Cahill as below:

Please try enable "Formula-level error management" option within Advanced settings of App settings, otherwise, null or empty values are not sent on Patch requests.

 


Please take a try to enable the "Formula-level error management" option within Advanced settings of App settings, then check if the issue is solved.9.JPG

 

In addition, you could also consider take a try to use UpdateIf function instead of Patch function to achieve your needs. Please take a try with the following function on your side:

UpdateIf(
    col_SelectedOrderItems,
    ID=ThisItem.ID,
    {
      OrderItemStatus:val_Status.Selected.Value,
      DrexFundNumb:Value(val_Fund.Text),
      DrexOrgNumb:Value(val_Org.Text),
      ShowSave:false
    }
)

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

UpdateIf function

 

Best regards,

Kris

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.
6 REPLIES 6
Community Support Team
Community Support Team

Re: Patch Problem: Existing data updated, new data not written to collection

Hi @ChadVKealey,

 

I think I have reproduced your issue. When existing items have blank value in Number field, patching collection won't update the number. I will discuss about this issue with my colleague and see if they have any suggestions.

 

Regards,

Mona

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

Re: Patch Problem: Existing data updated, new data not written to collection

Hi @ChadVKealey,

 

I just tested with Patch SharePoint list data source directly and the number fields get updated as expected. So far please workaround this by patching SharePoint list directly, do not use the collection. Sorry for the inconvenience.

 

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ChadVKealey
Level 8

Re: Patch Problem: Existing data updated, new data not written to collection

Thanks @v-monli-msft. Actually, I found another workaround that should minimize the number of other changes I need to make. I'm adding two new columns to the collection (DrexFundTemp and DrexOrgTemp) and writing into those, which appears to work. This way I can keep my existing "Submit" formula, just modify it to patch the data from those temp columns to the SharePoint columns. Basically, I don't want the Order Items' status to be updated before the Order's status is (to keep the data flow synced).

Community Support Team
Community Support Team

Re: Patch Problem: Existing data updated, new data not written to collection

Hi @ChadVKealey,

Just an update -- Response from @Corey Cahill as below:

Please try enable "Formula-level error management" option within Advanced settings of App settings, otherwise, null or empty values are not sent on Patch requests.

 


Please take a try to enable the "Formula-level error management" option within Advanced settings of App settings, then check if the issue is solved.9.JPG

 

In addition, you could also consider take a try to use UpdateIf function instead of Patch function to achieve your needs. Please take a try with the following function on your side:

UpdateIf(
    col_SelectedOrderItems,
    ID=ThisItem.ID,
    {
      OrderItemStatus:val_Status.Selected.Value,
      DrexFundNumb:Value(val_Fund.Text),
      DrexOrgNumb:Value(val_Org.Text),
      ShowSave:false
    }
)

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

UpdateIf function

 

Best regards,

Kris

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.
ChadVKealey
Level 8

Re: Patch Problem: Existing data updated, new data not written to collection

I did try "UpdateIf", but it seemed to be overwriting things in a destructive way...I probably didn't have the syntax right. 

 

But, the  "Formula-level error management" setting did the trick! Thanks...I would not have thought of that.

 

So, while changing that setting made this work, I still call this a bug. App developers shouldn't need to enable "experimental" features to make things work the way they're supposed to.

ChadVKealey
Level 8

Re: Patch Problem: Existing data updated, new data not written to collection

Actually, I spoke too soon. I'm not sure what I did to get it to work once, but it seems to be not working again. I'm going to try the UpdateIf function instead and if that doesn't help, go back to my other workaround. Hopefully the underlying issue is resolved at some point soon.

 

In talking to one of the PowerApps team at Ignite today, they said that the Formula-level Error Management option allows nulls to be written, but may not help in this case (trying to write new data into a previously null field). I might go bug them about it tomorrow.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 257 members 4,438 guests
Please welcome our newest community members: