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

Problem using Patch - record not found?

Hi,

 

I have a PowerApp which is connected to a local SQL Server through a Data Gateway. On the click of a button, I am trying to update a specific record in a table. I am trying to use the following patch function:

 

 

Patch('[dbo].[SOP10100]', First(Filter('[dbo].[SOP10100]', SOPNUMBE = "QTEST1028")), {SOPTYPE:2, DOCID:"STDORD"})

The error that I am getting is the following:

powerapps1.png

I can't figure out what I am doing wrong...the record exists in my table:

powerapps2.png

 

Any ideas?

 

Thanks for the help,

Tudor

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Problem using Patch - record not found?

Hi @Tudor,

 

Yes the error could be reproduced from my side, only when I try to change the Primary Key value of the table.

So in your scenario, the change record part:

{SOPTYPE:2, DOCID:"STDORD"})

Is SOPTYPE or DOCID a primary key?

The Primary key defined under SQl table is acted as the row identifier, which is not allowed to change at the current time.

This should be a current limitation, I will collect this as a feedback from my side.

To workaround, please define another Primary key in the table, make sure the field that you would like to update is not configured as the primary key.

Regards,

Michael

Community Support Team _ Michael Shao
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

2 REPLIES 2
Community Support Team
Community Support Team

Re: Problem using Patch - record not found?

Hi @Tudor,

 

Yes the error could be reproduced from my side, only when I try to change the Primary Key value of the table.

So in your scenario, the change record part:

{SOPTYPE:2, DOCID:"STDORD"})

Is SOPTYPE or DOCID a primary key?

The Primary key defined under SQl table is acted as the row identifier, which is not allowed to change at the current time.

This should be a current limitation, I will collect this as a feedback from my side.

To workaround, please define another Primary key in the table, make sure the field that you would like to update is not configured as the primary key.

Regards,

Michael

Community Support Team _ Michael Shao
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
Tudor
Level: Powered On

Re: Problem using Patch - record not found?

@v-micsh-msft

 

You are correct, I am trying to modify one of the segments of the primary key of my table. I know this is not a good idea in general but this is just for testing. 

 

Thanks Michael for pointing that out, I did not know that this was a current limitation. 

 

Tudor

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 (Last 30 Days)
Users online (5,221)