Showing results for 
Search instead for 
Did you mean: 
New Member

Inserting Records - Primary Key set to database sequence?

Hi there,


I'm creating an application to insert records into a Postgres database, but having problems with the Primary Key.


Powerapps is insisting that I try to set a value, despite the database being set to default new records to the next value in the sequence.


Is there anyway I can force PowerApps to rely on the database sequence?


I am using MySql DB. And I do the following,

You have to make sure that your primary key value is set to Autoincrement. Then in your Patch set the primary key into 0 value. The DB will take responsibility for the sequence.   


OnSelect= Patch('[database_name].[table_name]',Defaults('[database_name].[table_name]'),{column_primary_key:0, column__2: ... });

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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