PRIMARY KEY: App connected to MySQL DB > with MY_ID field set as Autoincrement

FHLPC
New Member

The app is connected to a MySQL database. AppSheet doesn’t have auto-increment (and I am not interested in a random UNIQUEID()).

I created a database column called MY_ID as primary key set as unique, and auto increment. Every time the user adds a new row, the database will increment the MY_ID column automatically. This provides me with the autoincrement.

Within the app, I cannot use MY_ID as the key, because it will mark it as required. It cannot be set as required, it has to be empty, because the database will provide a new MY_ID for every new record.

I tried using the _RowNumber as key, but it trows this error:
3X_b_1_b1dfdc907e68feeaa85db8af19a7a477b4de4d7b.png

Should the _RowNumber be created within MySQL? I am not able to add new records.

Any suggestions on how to set the app table key? And keep the DB to generate an autoincrement field?

0 1 360
1 REPLY 1

Steve
Platinum 4
Platinum 4

The app must assign the row’s key column value. There is no way to avoid that. A server-generated value cannot be used as the row’s key within the app. The best you can hope to accomplish is to have two separate and independent values: the key the app uses in one column, and a key the database uses in another column. They cannot be the same.

Top Labels in this Space