cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tudor
Helper I
Helper I

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
v-micsh-msft
Community Support
Community Support

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

5 REPLIES 5
v-micsh-msft
Community Support
Community Support

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

@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

I am getting the same error but by changing the primary key doesn't work.

izzooot
Frequent Visitor

I also have the same issue. The columns I'm updating are not PK

eric1599
Frequent Visitor

For me it's working for regular PowerApps, but does't work on government tenants. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,087)