How do I create an auto-incrementing row number with Glide Tables?

This is a question that comes up a lot, so creating this topic to use as a reference.

Typically, there are two distinct use cases when it comes to auto-incrementing row numbers.

  • Use Case 1:
    – We need to generate a Part Number, or an Order Number, or an Employee ID. Once the number is generated, it should never change, even if rows are deleted.
    – The general approach for this use case is to maintain a static counter, use it to craft a suitably formatted ID, and increment it by one every time a new row is added.
    – The following video walks through that step by step:
  • Use Case 2:
    – For the second use case, we want a dynamic row number that will automatically change as new rows are added/removed.
    – The solution for this use case is very simple, and takes advantage of one of the new Array Plugin columns. Credit to @11183 for first describing the approach.
    – The following video shows how to do it:

Hi @Darren_Murphy , thanks for this F.A.Q.
About case 1, I use the same method but with a little variation:

  • instead of building the two template columns (one in staff, and one in lookup), in lookup I prefer to define a rowid column, retrieve its content in staff via a single value column, and then build a single relation between these two values.
    Could it be better from a performance standpoint, in your opinion?
1 Like

hey @Roldy

I’m not sure I could say whether one approach is better than the other. The end result is the same in both cases, because you need that single relation. It’s just a matter of how you get there. My guess would be that it probably doesn’t make much difference for this use case. I think your approach is fine :slight_smile:

1 Like

Great explanations @Darren_Murphy ! Bookmarking these for future use!

Nice. Changing the category to “Tutorials” instead of Help.

Thanks for this! Will get referenced a lot, I’m sure.