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

10 REPLIES 10
Helper I
Helper I

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

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (60,146)