cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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."

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?

Highlighted
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."

Highlighted
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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,123)