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

The requested operation is invalid. 2 keys were specified, but 3 values were provided.

Hi,

 

Can someone help me with this error?  The context is when trying to use the function SubmitForm() I get the error below.  My data source is a SQL Server.  I have 5 other tables in this app and they are behaving just fine.  I am able to read and write to them in the same manner (submit form function).

 

keyIssues.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
samuelJ
Level 8

Re: The requested operation is invalid. 2 keys were specified, but 3 values were provided.

@mdevaney thanks for your help,

 

After spending quite some time on this, i think i found a solution/workaround.  Using the SubmitForm() function works on some records in the table but not all of them.  For every record i get the error there is one thing in common.  One of the columns that makes up the composite key has a comma in the data. 

I have replaced all the comma's with spaces and now no records produce the error.  Not sure if this is a known limitation I am just unaware of or this is something that PowerApps needs to address. 

 

My guess is that PowerApps uses the data in the primary key(s) in a csv fashion to write to the DB and comma's in the data is not accounted for.   It appears that commas in columns that are not part of the PK write just fine.  

View solution in original post

4 REPLIES 4
Super User
Super User

Re: The requested operation is invalid. 2 keys were specified, but 3 values were provided.

@samuelJ 

Are you working with composite keys in your SQL Table?  You are not allowed to change any value forming a composite key in your Edit Form.  Instead a new record would need to be created.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

samuelJ
Level 8

Re: The requested operation is invalid. 2 keys were specified, but 3 values were provided.

Hi @mdevaney ,

 

My understanding of a composite key is: a key that is made up of 2 or more columns.  Going off of this definition, yes the table I am using submitForm() on has a composite key.  However, all the other tables also use composite keys and they are working as expected.  I am also not editing the primary keys of the table.

 

Is there a way to easily do SubmitForm() an an update?

Super User
Super User

Re: The requested operation is invalid. 2 keys were specified, but 3 values were provided.

@samuelJ 

Hmmm... typically this error occurs when the composite key value is being updated.

 

What is difference between the forms that are working and the one that is broken?  Are the primary key fields included or excluded in those forms?  What else do you notice?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

samuelJ
Level 8

Re: The requested operation is invalid. 2 keys were specified, but 3 values were provided.

@mdevaney thanks for your help,

 

After spending quite some time on this, i think i found a solution/workaround.  Using the SubmitForm() function works on some records in the table but not all of them.  For every record i get the error there is one thing in common.  One of the columns that makes up the composite key has a comma in the data. 

I have replaced all the comma's with spaces and now no records produce the error.  Not sure if this is a known limitation I am just unaware of or this is something that PowerApps needs to address. 

 

My guess is that PowerApps uses the data in the primary key(s) in a csv fashion to write to the DB and comma's in the data is not accounted for.   It appears that commas in columns that are not part of the PK write just fine.  

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,133)