Appsheet application id not generated in sequence

Hi,

I have build appsheet application with google sheet as data source. In the request table I Have added Id coulmn as number type and its initial value formula as (MAX(Request[Id]) + 1). but when creating request Id number is not coming in sequence(eg. 1,2,3,4,5,.....).

Kindly help me , if have any solution

0 3 58
3 REPLIES 3

This approach doesn't work if you have more than one user or one device because the MAX() value can be different in each devices.. depending on when the app was synced.

If you need sequential numbering, I would suggest leaving the ID as UNIQUEID() to guarantee a unique ID for each row, then add a created column as a date time and a record_number column. The record_number column would then use a spreadsheet formula RANK() to get a ranking of the created date time. I've used this method in the past with success, but keep in mind if a record is deleted that record_number would change, so it would be best to do a pseudo delete then so the ranking persists.

What that looks like in AppSheet is setting your record_number column to this for Auto Compute

rbucsis_0-1706718578354.png

Then you would see [sync to compute]

rbucsis_1-1706719531088.png

after a quick sync you will see the new ranking

rbucsis_2-1706719560960.png

I would strongly advise against doing this method for the ID directly, because as I said, any deletes of records will change the numbering, which would result in broken references, and I would also strongly suggest Pseudo Deletes over actual Deletes instead. That's simply adding a deleted column that you populate with a value with an action when you click it, and then a security filter of ISBLANK([deleted]) on that table. This way you won't see the "deleted" records, but the ranking should still persist!

 

 

As others have stated already using incremental numbers in a key column presents a challenge within Appsheet's structure. I am currently working on an app where an incremental numbering system is required based on fiscal year selection for the new record. I am testing the number increment during a bot 'add only' event though, where I am hoping that since the event is handled server side vs client side each successive request will still observe increment numbering since it is generated server side vs in an initial value setting on the client.

Top Labels in this Space