Auto Numbering

Interesting question. I’m not quite sure if 2 people goes into an add action at the same time, will the numbering stand corrected? Would a little difference in time enough for the “next” column to recalculate?

2 Likes

I’ve seen evidence that compound actions suffer from race conditions.
This is different, and of course I don’t know the answer, but my guess would be yes it’s possible.
My understanding is that all these calculations happen client-side, so that probably makes it even more likely that a collision is possible. @Jeff_Hager, thoughts?

3 Likes

I would have to agree. I’ve never done any heavy testing on this theory, and like you said, the calculations happen on the device, so it takes a few seconds to sync back to the server and populate the update to other users. Combining this count with some sort of ID or value that’s unique to a user, would probably help for keeping values unique, but yes, this doesn’t cover all situations where sequential numbering is absolutely necessary. In that case, the only thing that I would trust is a script.

Two things I think we need from glide:

  • A function similar to the RowID column that would automatically number rows sequentially, but also make the number stay static forever.
  • A rank column that would let us dynamically number a column (as a bonus, let us number based on a particular sort order we choose, or number within a relation).
7 Likes

@Jeff_Hager and @Darren_Murphy thanks for pointing this out. I considered changing my setup to the suggested setup. But with the mentioned problem it is not time for changing.

Concerning whether the number should never change - this is beneficial in some cases but I also need a sequential numbering to be used for traversing a list by used of increment action. If you delete a row then the numbering of the following rows should change. From the current row I need to know which row is previous and which is next.

2 Likes

mmm, so that’s an example of where the arrayformula solution works best, because if/when rows are deleted it will automagically renumber the remaining rows.

3 Likes

@Darren_Murphy exactly. So a similar functionality like arrayformula in glide builder would be appreciated a lot

2 Likes

@Darren_Murphy maybe the need is really next/previous one in the list when it has been filtered and sorted by X,Y parameters.
Or give me the item 10 places from here in the list

2 Likes

I have tried. USer have to enter the user id isnt it?

Sorry, I don’t understand your question.

Please show what you have that isn’t working as you would expect.

My intention was the user no need to enter any number.
The quotation number is generated by the system itself.
The admin will start the starting number only.
For example , me set up the 1000 and once row is added, automatically 1001.
From this method , the user have to fill in the ID number. correct?

Let’s say the destination column is called ‘Order ID’.
Create a Rollup column that takes the Max of Order ID - call that MaxOrderID.
Then create a Math column that is MaxOrderID + 1 - call that NextOrderID.
And NextOrderID is then used in the form submission.

No, if you set that up correctly as I described, then the next order ID is already available.
You just use the value in that column (NextOrderID) to populate the OrderID column when a new order is submitted.

Let’s say the destination column is called ‘Order ID’.
Create a Rollup column that takes the Max of Order ID - call that MaxOrderID.
Then create a Math column that is MaxOrderID + 1 - call that NextOrderID.
And NextOrderID is then used in the form submission.

Let say in my situation as below,

your Order ID is my ID to start
your MaxOrderID is my Cumulative num
Your NextOrderID is my Roll up+1
Then that is my results

Okay, a picture tells a thousand words :slightly_smiling_face:

My solution will only apply for new rows that are added. It won’t automatically apply to pre-existing rows.
And (it case it wasn’t clear), you need to populate your “ID to Start” column (using the value in “Roll Up +1” as part of the Add Row action that creates a new row.

Now I understand.
Populating the add row function.
Thanks a lot!

But I have continuous question .
Eg . the quotation number is GE-2103-1001-Rev.0.
On edit, the revision 0 at the back will change to Rev.1 , Rev.2 and so on.
How to make if ID is same and edit the revision number will be adding.

You should be able to do that with a template column that takes the base quotation number, and appends the increment to the end of it.

@ThinhDinh you’re better with these types of formulas than I am :wink:

How would you adjust the above such that it starts auto-incrementing from 1, and applies to a specific number of rows? For example:

  • I want to start auto-incrementing at row 20, and continue for 50 rows
  • Then at row 100, I want to start again from 1 and continue for another 100 rows
  • etc, etc

The row counts above are arbitrary and random - I’m just looking for a general approach. ie. I want to wind up with something that looks like this:

EDIT: Never mind, I figured it out. I was just being lazy :rofl: :rofl:

=ARRAYFORMULA(ROW(C454:C466)-453)

That would start counting from 1 at row 454, and continue until row 466…

Screen Shot 2021-03-09 at 5.18.27 PM

3 Likes

Good solution :wink:

Actually, yes and no.
My use case for this is that I have a sheet with several logical groupings of rows.
And for each group, I want an auto-incrementing column from 1-n
So I’ve inserted the above formula pattern in the first row of each group, and it works, but…

If I insert a column into any of the groups, then the number sequence in all groups below it is immediately offset by one… so instead of starting at 1, they start at 2. In typing this out, I’ve realised that this happens because the return value of row() changes, but I can’t think of a way to get around it - can you?

Something like this I guess?