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?

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

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
secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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!

Top Solution Authors
Top Kudoed Authors
Users online (6,232)