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

**URL:** <https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572>\
**Category:** Community Resources\
**Tags:** tutorial\
**Created:** [March 13, 2022, 4:33am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572 "2022-03-13T04:33:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 13, 2022, 4:33am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/1 "2022-03-13T04:33:25Z")

</div>

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:

https://www.loom.com/embed/58bb8a0bc8294fd9b03ca68467e924ed?sid=2e96e0b1-d1ff-42f0-bfd2-dd4926af953d

_If the above video won’t play, paste the following into a browser:_

```auto
https://www.loom.com/share/58bb8a0bc8294fd9b03ca68467e924ed?sid=2e96e0b1-d1ff-42f0-bfd2-dd4926af953d

```

- 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:

https://www.loom.com/embed/13166419c13d4e44b961d01be5f2f801?sid=5f479f3d-92e9-4397-92cc-0df0b34f2cd4

_If the above video won’t play, paste the following into a browser:_

```auto
https://www.loom.com/share/13166419c13d4e44b961d01be5f2f801?sid=5f479f3d-92e9-4397-92cc-0df0b34f2cd4

```

…

---

<div class="post-metadata">

**Author:** ![Roldy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/roldy/32/36068_2.png) [@Roldy](https://community.glideapps.com/u/Roldy)\
**Post date:** [March 13, 2022, 11:30am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/2 "2022-03-13T11:30:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 13, 2022, 11:45am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/3 "2022-03-13T11:45:35Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)\
**Post date:** [March 13, 2022, 6:41pm UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/4 "2022-03-13T18:41:19Z")

</div>

Great explanations @Darren_Murphy ! Bookmarking these for future use!

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [March 13, 2022, 7:56pm UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/5 "2022-03-13T19:56:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [March 14, 2022, 12:36am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/6 "2022-03-14T00:36:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 10, 2022, 6:37am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/8 "2022-10-10T06:37:48Z")

</div>

Used this method for an app that multiple user get access

But the number always get off, for example:

90  
91  
92  
(blank)  
23  
54  
55

the number doesnt consistently follow from the number we used to start the number

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 10, 2022, 6:40am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/9 "2022-10-10T06:40:50Z")

</div>

Can you share details of how you implemented this?

If I was to make a wild guess, I’d say it sounds like you might be using some User Specific Columns where you shouldn’t be. But that is just… a wild guess

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 10, 2022, 6:45am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/10 "2022-10-10T06:45:29Z")

</div>

created another table (Table B)  
in Table B

 ![table b](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/b/dbb982fbf8367613b8ff6013ce1bb101b41dc646.png)

then at the original table  
i create a relation to table B (Number) and call a single value out of it  
 ![relation from table A](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/e/ee1c9907b8f90b84e673e82177dec0afff1f4a68.png)

So whenever a user create/add a entry, i call the single value , and auto increment the table B’s Number by 1

 ![entry action](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/5/759a75f4342898a1214b9d7574e11885111d65cf.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 10, 2022, 6:53am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/11 "2022-10-10T06:53:03Z")

</div>

It looks like you have some sort of variation of the first option that I showed in my original post.

Is there any reason why you didn’t want to set it up in a similar way that’s shown in the video?

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 10, 2022, 7:13am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/12 "2022-10-10T07:13:26Z")

</div>

hmm, im sorry arent it the same ?  
since i call a relation to the lookup value ?

or is it important to check the current user ?

btw, im still abit confused about the If Then Else function there ?  
what does it do ?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 10, 2022, 7:52am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/13 "2022-10-10T07:52:23Z")

</div>

> [@Martinus\_Goh](#):
>
> btw, im still abit confused about the If Then Else function there ?  
> what does it do ?

In the example I showed in the video, the if-then-else column is used to determine if the EmployeeID needs to be zero-padded. You can probably ignore that.

> [@Martinus\_Goh](#):
>
> hmm, im sorry arent it the same ?

No, it doesn’t look the same to me.

> [@Martinus\_Goh](#):
>
> or is it important to check the current user ?

Using the signed in user ID is used in a template to create a relation between the two tables.  
Actually, looking back at that now, it could be simplified quite a bit. Instead of using templates to create a relation, we could just use a Single Value → First → Whole Row to grab the whole first row from the Lookup table, and then use a Lookup through that Single Value to fetch the next ID, and also use it for the onSubmit increment action.

Make yourself a copy of the below App and use that as an example for your own - you might find it a bit simpler to understand.

> **[HTML Tables Concept](https://html-tables-concept.glideapp.io)**

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 10, 2022, 8:03am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/14 "2022-10-10T08:03:40Z")

</div>

Ok Thanks for the explanation and the copy of the apps  
cause since the beginning creating my own apps, im been stuck to that auto increment, already watch the video multiple time, but still dont get it. 🫠

hope this method wont show any blank or random number again

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 10, 2022, 8:06am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/15 "2022-10-10T08:06:53Z")

</div>

anyway can i ask about the number entry? im sorry if its not about this topic

while inputting a price number, is it possible to have a realtime comma separating thousand automatically ?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 10, 2022, 8:16am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/16 "2022-10-10T08:16:34Z")

</div>

> [@Martinus\_Goh](#):
>
> while inputting a price number, is it possible to have a realtime comma separating thousand automatically ?

No, but if you format the column where the Number is being saved to include a group separator, then it will be inserted when the saved value is displayed.

 ![Screen Shot 2022-10-10 at 4.13.24 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/5/755209c1e5778818fb5bd3a87280db9f1b5b7b1e.png)

_Note: the separator used can vary, according to the Users device regional settings. ie. some regions use a period (`.`) instead of a comma_

---

<div class="post-metadata">

**Author:** ![Martinus\_Goh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/martinus_goh/32/53576_2.png) [@Martinus\_Goh](https://community.glideapps.com/u/Martinus_Goh)\
**Post date:** [October 11, 2022, 4:39am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/17 "2022-10-11T04:39:15Z")

</div>

hello, did that method, but it still make error

![Capture](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/5/85cde9ad448d7bf9a0e102941440e298c64bde43.png)

input by multiple user with row owner set up

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 11, 2022, 5:42am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/18 "2022-10-11T05:42:51Z")

</div>

Obviously, something is wrong. But it’s really difficult for me to say what just by looking at a single screen shot. If you set it up the same as in the concept App, it will work, even with Row Owners applied. So if it’s not working for you, that means you must have done something different. In order to help you solve it, you need to help me understand what it is that you’ve done different.

---

<div class="post-metadata">

**Author:** ![marcos\_correia](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/marcos_correia/32/54954_2.png) [@marcos\_correia](https://community.glideapps.com/u/marcos_correia)\
**Post date:** [March 21, 2023, 11:18pm UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/19 "2023-03-21T23:18:21Z")

</div>

Ola boa noite… nao estou consegiundo realizar este modelo como no video, sera que poderia me ajudar… ele gera o codigo porem inseri um monte de zero no final…

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 22, 2023, 5:34am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/20 "2023-03-22T05:34:04Z")

</div>

If you show me how you have set it up, I may be able to point out where the problem is.

---

<div class="post-metadata">

**Author:** ![marcos\_correia](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/marcos_correia/32/54954_2.png) [@marcos\_correia](https://community.glideapps.com/u/marcos_correia)\
**Post date:** [March 23, 2023, 11:00am UTC](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572/21 "2023-03-23T11:00:49Z")

</div>

![Captura de Tela 2023-03-22 às 20.20.16](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b331f524bc6f7c5906fe703b7adf2eda17c87a61.jpeg)

BOM DIA TUDO BEM, SEGUE PRINTS DE COMO EU CONFIGUREI… SERA QUE SE EU TE DER ACESSO AO SISTEMA VC PODERIA VERIFICAR PARA MIM POR GENTILEZA?

[Next page](https://community.glideapps.com/t/how-do-i-create-an-auto-incrementing-row-number-with-glide-tables/39572.md?page=2)
