Within an app, I can have many individual pro...

(Jonathon Sinclair) #1

Within an app, I can have many individual projects, identified by a ProjectNo column. Within each project, I would like to have a sequential unique identifier (e.g., first record created on a new project should be ProjectNo-001).

A complication is that multiple persons may be adding records to the same ProjectNo simultaneously. AppSheet does not check the backend for the most recent record unless a sync is performed. Therefore, if two or more users are adding records, it is inevitable that duplicate records will be created.

One solution has been to calculate these unique identifiers in the backend with a Google Sheets formula. I am now looking to migrate some apps to a Postgres server and will need to look into server triggers to mimic this effect, however before I do so…

Has anyone encountered a similar scenario, and found a different solution? I have been thinking that it may be possible to trigger a workflow rule upon record creation that would in turn calculate the unique identifiers. I am not clear if this will solve the above mentioned problem with multiple users, however. From what dataset are the workflow rules triggering?

Any thoughts would be appreciated!!

(Levent KULAÇOĞLU) #2

Even 2 or more users record at the same time, as per the nature and probability of UUID, it’s not so possible that more than 1 user can create a record with exactly the same UNIQUEID().

(Levent KULAÇOĞLU) #3

Provided you create a Projects table and create a second table which will contain the child records of this table with a REF assignment, you don’t have to worry about anything I believe.

(Levent KULAÇOĞLU) #4

You can create that incremental IDs simply with a CONCATENATE formula and assign it as Label to your ref table’s ID, btw.

(Jonathon Sinclair) #5

@Levent_KULACOGLU I am a little confused… This is what I am aiming for:

UniqueID, ProjectNo, SequentialID ejkF89A,

Project A,

A-001 fje22FlN, Project B,

B-001 leKf29nf, Project A,

A-002

Each record can have a uniqueID(), however they also must have a sequential unique identifier that is specific to the project.

I could generate this within the app using CONCATENATE and COUNT([_THIS].[ProjectNo]), but if two users have synced recently they will get the same count and thus the same sequential ID.

Therefore I believe this has to be calculated in the backend, unless someone else has a solution (possibly involving workflows?)

(Aleksi Alkio) #6

I’m afraid there is no way to create such a feature where the realibility would be 100% with the app. Therefore you need to create that in the backend.