cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samuelJ Responsive Resident
Responsive Resident

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 Responsive Resident
Responsive Resident

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 Responsive Resident
Responsive Resident

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 Responsive Resident
Responsive Resident

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Attending MBAS? Claim your badge

Attending MBAS? Claim your badge

Whether you’re streaming the digital event live, or watching on-demand, claim your attendee badge to sport on your profile.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We're launching a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Emergency Response & Monitoring Solution

Emergency Response & Monitoring Solution

Microsoft has created a regional government emergency response and monitoring solution that is built on Power Apps and Power BI.

Top Solution Authors
Top Kudoed Authors
Users online (5,980)