How do you have an add form that auto increme...

data
(Quy Nguyen) #1

How do you have an add form that auto increment the primary key? For a simple table (ID, FirstName, LastName) I want to have when you click the add button it has the ID field autofilled with the current max id + 1. Is that possible with appsheet?

(Suvrutt Gurjar) #2

Hi @Quy_Nguyen You can use MAX expression, ,only under some specific app usage conditions.The expression can be something like

MAX(TableName[ID])+1

However, please note that AppSheet typically does not recommend a sequential key generation as mentioned in

attached article.

You may implement

a sequential key only if your app has only one user or if it is a multi-user app,

then

any two users are never

likely to add a record simultaneously or the app is not going to be used in offline environment for adding records.

help.appsheet.com - Sequential Keys Sequential Keys help.appsheet.com

(Aleksi Alkio) #3

I would not recommend this if your app has more than one user. The duplicate value can happen even if those two users are not using the app in a same time. It’s not a timing issue, it’s a syncing issue. If the other user hasn’t used (synced) the app for example within last two days, this duplicate key will happen.

(Arabian Corner) #4

I would recommend using this expression [_Rownumber]-1…