Duplicate Sequential ID

Hi everyone, I’m facing the following problem:

I created an application to control courses, in which I have classes and students enrolled in these classes. I had the need to automatically generate a friendly ID for the classes and another for the enrollment of students, this Exclusive ID would be shown in the classes tab and in the enrollments tab.

I created a number column for “Class ID”, starting from the number 1, a “Max_Número” rollup column to bring me the highest number in the “Class ID” column and a Mathematical Column “Next ID” that adds + 1 to the “Max_Número” column ". Well, in the Class Creation form, the ID was assigned automatically in the “class id” column using the special value in the “next Id” column. everything went very well while the creation of classes was done by only one user. today when 3 users created 20 classes, I noticed several duplicate IDs. I use the native forms of GLIDE, not the custom one. I had to manually correct the IDs directly in the base.

The same is happening in the enrollments table, where I used the same automatic sequential ID methodology. see that the value is doubling when registered by different users, according to the email column.

How could I assign an automatic, sequential and unique ID to each creation of a new class or new enrollment?

Yes, this is a known issue, and there is no easy solution.

The only solution that I am aware of is to delegate the allocation of the ID’s to a 3rd party such as Make. So instead of adding the row directly, you could send a webhook to Make. Make would pick the next available ID, and then insert the new row via the Glide API. Using this method, it wouldn’t matter if there were multiple users adding records at the same time, as the requests would be queued in Make and the ID’s would be allocated correctly in sequence.

Thanks for the contribution, I will check this possibility. would it be possible to make make update only the ID column? that way, I wouldn’t have to pass all the values for creating a new line to make, just inform that a new line was created and it would fill in the ID column, I don’t know if that’s possible.

That’s a little bit tricky, because you would need to send the RowID of the newly created row, which of course isn’t available until after the row has been created. So it’s a bit of a catch 22.

What you could try is adding a short wait condition after adding the row before sending the webhook. That might work, but I’m not sure. You would need to test it.

1 Like

Possibly you could leverage the Unique Identifier to create your own row-ID.

What I would do is set the Unique ID to a user specific column somewhere in my flow before submitting the form. Then send that value to both your table and Make.

The end result should be we know our row-ID before we submit the form.

Nice idea, but you need the actual (Glide generated) RowID for the API call back to Glide :wink:


Trueeee. I was almost certain I had done this before but I guess it was Make + GSheet.

I was thinking here. since my database is synchronized between my excel and glide spreadsheet. so, if it is to use a third party solution, I prefer to look for an excel formula that creates this unique and sequential id, in the id column. I believe there must be one, I think this can be more practical than involving Make.

Yes, that could also work.

ready. I used the excel formula “Lin( ) -1” to give me a sequential id starting from the number 1. Now it’s a matter of waiting to see how it behaves with multiple users entering data simultaneously. even if i delete a line in the glide, that line will be blank in excel and will not change the position of the other lines, this guarantees that my formula will not be recalculated and change the existing IDs. I think that’s risky. if my new rows are not populated in the table sequence then my table format will be lost and my column with the formula will not be replicated to the cells below.

Are you using Excel or Sheets? Does the “Lin() - 1” formula give you the row number minus 1? Do you have to copy it down every time there’s a new row?

I put the formula directly in the column of my Excel spreadsheet, which synchronizes with the glide table. as the first line is the header, my account starts from the second line, so I used the “-1” for my first ID not to be the line number 2. my data range is formatted as a table in excel, this causes the formula to be entered on every new line.

Yeah I was just curious about this. In Google Sheets, if you want to do that, the equivalent is an arrayformula.

This new row gets the same formatting and padding as the table range when it’s inserted just below the range, my concern is that a row skips that sequence and isn’t included just below the range, not being formatted, and I don’t try this column of the formula filled in that row and the ones that come after it. This occurred recently.

That does sound a little fragile. If this is critical, I think the Make/API option would be better.

1 Like