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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (73,029)