# ID's for lines

**URL:** <https://community.glideapps.com/t/ids-for-lines/27534>\
**Category:** Ask for Help\
**Created:** [June 2, 2021, 7:40pm UTC](https://community.glideapps.com/t/ids-for-lines/27534 "2021-06-02T19:40:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![AymenM](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/aymenm/32/21370_2.png) [@AymenM](https://community.glideapps.com/u/AymenM)\
**Post date:** [June 2, 2021, 7:40pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/1 "2021-06-02T19:40:45Z")

</div>

Hello Guys,

I’d like to create a sort of ID for every single line but not the usual row-id which is impossible to learn by heart. Something like 5 digits or 4.

Any advice on how to proceed ?

---

<div class="post-metadata">

**Author:** ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)\
**Post date:** [June 2, 2021, 7:49pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/2 "2021-06-02T19:49:12Z")

</div>

If the row id is too long then use an arrayformula in another column that just narrows down it’s length. Let’s say row id is in column A ans we want our new unique id to be in column B. then b2 would look like this (assuming you are using headers):

=arrayformula(if(a2:a="","",left(a2:a,5)))

---

<div class="post-metadata">

**Author:** ![AymenM](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/aymenm/32/21370_2.png) [@AymenM](https://community.glideapps.com/u/AymenM)\
**Post date:** [June 2, 2021, 7:51pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/3 "2021-06-02T19:51:05Z")

</div>

Thanks ! However. I’m using Glide Tables…

---

<div class="post-metadata">

**Author:** ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)\
**Post date:** [June 2, 2021, 8:00pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/4 "2021-06-02T20:00:52Z")

</div>

Oh, I see…hmmmmm…you can use a similar formula in the if scenario

---

<div class="post-metadata">

**Author:** ![AymenM](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/aymenm/32/21370_2.png) [@AymenM](https://community.glideapps.com/u/AymenM)\
**Post date:** [June 2, 2021, 8:43pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/5 "2021-06-02T20:43:20Z")

</div>

> [@Drearystate](#):
>
> =arrayformula(if(a2:a=“”,“”,left(a2:a,5)))

Thanks !

Should I add it like that ?  
 ![Capture d’écran 2021-06-02 à 22.42.37](https://sea2.discourse-cdn.com/flex020/images/transparent.png)

(It’s a joke between)

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 2, 2021, 10:04pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/6 "2021-06-02T22:04:05Z")

</div>

😉 seriously?

---

<div class="post-metadata">

**Author:** ![AymenM](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/aymenm/32/21370_2.png) [@AymenM](https://community.glideapps.com/u/AymenM)\
**Post date:** [June 2, 2021, 11:20pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/7 "2021-06-02T23:20:55Z")

</div>

Trust me I was sarcastic here…

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 2, 2021, 11:29pm UTC](https://community.glideapps.com/t/ids-for-lines/27534/8 "2021-06-02T23:29:35Z")

</div>

the only way, is to from a beginning when you adding a row in that table have column set +1 for the new row… then you will have all rows nicely numbered… you can add another template column to add table name to that number, so you will have a great indicator what row from which table this data is coming from.

---

<div class="post-metadata">

**Author:** ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)\
**Post date:** [June 3, 2021, 1:53am UTC](https://community.glideapps.com/t/ids-for-lines/27534/9 "2021-06-03T01:53:49Z")

</div>

🤣🤣🤣

---

<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:** [June 3, 2021, 2:47am UTC](https://community.glideapps.com/t/ids-for-lines/27534/10 "2021-06-03T02:47:36Z")

</div>

> [@Auto Numbering](https://community.glideapps.com/t/auto-numbering/20355/12):
>
> Here is how I would do it: “Padding” is just a simple ITE… So putting all that together, 4 columns required: Rollup to determine the current max order ID Math column to increment that by 1 ITE column to determine how many zeros required for padding Template column to join 2 & 3

I’ve used this method in a few apps now. The only gotcha is that it is subject to a race condition if two or more users happen to be creating a new record at the same time. So definitely not recommended for high volume usage. But if records are added infrequently, then it works fine.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 3, 2021, 2:53am UTC](https://community.glideapps.com/t/ids-for-lines/27534/11 "2021-06-03T02:53:05Z")

</div>

how is this to have numbering… is just padding with zeros in front

---

<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:** [June 3, 2021, 2:54am UTC](https://community.glideapps.com/t/ids-for-lines/27534/12 "2021-06-03T02:54:21Z")

</div>

Read it carefully 😉

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 3, 2021, 2:57am UTC](https://community.glideapps.com/t/ids-for-lines/27534/13 "2021-06-03T02:57:36Z")

</div>

sorry… i don’t see it… the numbers are already there… not from glide… from GS formula

---

<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:** [June 3, 2021, 3:00am UTC](https://community.glideapps.com/t/ids-for-lines/27534/14 "2021-06-03T03:00:35Z")

</div>

> [@Auto Numbering](https://community.glideapps.com/t/auto-numbering/20355/12):
>
> So putting all that together, 4 columns required:
> 
> 1. Rollup to determine the current max order ID
> 2. Math column to increment that by 1
> 3. ITE column to determine how many zeros required for padding
> 4. Template column to join 2 & 3

Yes, steps 3 and 4 just do some padding (because that’s what the OP in that topic was looking for). But steps 1 & 2 provide auto-numbering.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 3, 2021, 3:08am UTC](https://community.glideapps.com/t/ids-for-lines/27534/15 "2021-06-03T03:08:08Z")

</div>

maybe i’am stupid… but i don’t see how you create auto numbering, if you increment max order by 1 , you will get all numbers in column , max order +1… all the same

---

<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:** [June 3, 2021, 3:12am UTC](https://community.glideapps.com/t/ids-for-lines/27534/16 "2021-06-03T03:12:56Z")

</div>

Of course you’re not stupid… far from it 🙂

Maybe it’s not clear…  
In order to work, it needs a single row to “kick start” the auto numbering.  
Let’s say the column you want auto-numbering is called ID.  
You start off with one row, with an ID of 1.

- You do a rollup on that column, which takes the maximum order number
- Then a math column that adds 1 to that rollup
- Then in the action that creates a new row, you use that math column to set the ID column

Make sense now?

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 3, 2021, 3:14am UTC](https://community.glideapps.com/t/ids-for-lines/27534/17 "2021-06-03T03:14:57Z")

</div>

OMG! this is what i wrote in the beginning…  
I’m trying to find the way to get numbers for existing rows…

---

<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:** [June 3, 2021, 3:16am UTC](https://community.glideapps.com/t/ids-for-lines/27534/18 "2021-06-03T03:16:06Z")

</div>

🤣

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [June 3, 2021, 3:17am UTC](https://community.glideapps.com/t/ids-for-lines/27534/19 "2021-06-03T03:17:28Z")

</div>

hahahahha… you were trying to explain me the solution that i proposed in the first place… LOL  
problem is, when you have already rows in the Glide table… how to auto number them

---

<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:** [June 3, 2021, 4:13am UTC](https://community.glideapps.com/t/ids-for-lines/27534/20 "2021-06-03T04:13:48Z")

</div>

hmm, if the number of rows isn’t too many, you could use the same technique and instead of adding new rows, use a Set Columns action.  
So show them all in an Inline List and filter where ID is empty.  
Set the Action on the Inline List to do a Set Columns, setting the ID to MaxID+1  
Then as you tap on each item, the ID is set to the next ID, and the item is removed from the list.

Should work, no?

[Next page](https://community.glideapps.com/t/ids-for-lines/27534.md?page=2)
