# Unique ID for each new data type/thing

**URL:** <https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443>\
**Category:** Need help\
**Created:** [November 23, 2020, 2:24pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443 "2020-11-23T14:24:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrase9](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/phrase9/32/187478_2.png) [@phrase9](https://forum.bubble.io/u/phrase9)\
**Post date:** [November 23, 2020, 2:24pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/1 "2020-11-23T14:24:53Z")

</div>

Hi Guys

When creating a new thing, how do I go about creating a unique ID for it, so that the thing can be displayed according to that ID. Preferably the ID would be in the form of an invoice name that increases by 1 each time a new thing is created e.g. mycompany0001 then mycompany0002 etc

Thanks in advance

---

<div class="post-metadata">

**Author:** ![deadpoetnsp](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/deadpoetnsp/32/64992_2.png) [@deadpoetnsp](https://forum.bubble.io/u/deadpoetnsp)\
**Post date:** [November 23, 2020, 3:04pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/2 "2020-11-23T15:04:55Z")

</div>

You can use Do a search for:count to get the count of those Things, and set a field to that number+1.

---

<div class="post-metadata">

**Author:** ![phrase9](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/phrase9/32/187478_2.png) [@phrase9](https://forum.bubble.io/u/phrase9)\
**Post date:** [November 23, 2020, 3:51pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/3 "2020-11-23T15:51:04Z")

</div>

@deadpoetnsp does this create an ID number or it just lets you search ?

---

<div class="post-metadata">

**Author:** ![deadpoetnsp](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/deadpoetnsp/32/64992_2.png) [@deadpoetnsp](https://forum.bubble.io/u/deadpoetnsp)\
**Post date:** [November 23, 2020, 4:20pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/4 "2020-11-23T16:20:28Z")

</div>

Ok let me break it down.

1. You can create a field, say, MyUID, in a Thing
2. When you create a new Thing (of that Type) you want to set MyUID to an increasing number, say index1, index2, and so on
3. in other words, when you make the second thing, you want the index n to be the same as the count of the Things right before the new Thing is created + 1
4. “Do a search for [type of Thing]:count” gets you the count of that type of Thing in Bubble
5. So when you create a new Thing of type X, in the workflow, set the field MyUID of that new Thing to [prefix+] Do a search for [that type of thing]:count
6. accordingly, the first Thing’s MyUID will become [prefix]+[0+1] = prefix1; there second Thing’s MyUID will become [prefix]+[1+1] = prefix2, and so on
7. you don’t need to use a prefix and can instead store a numeric id
8. Subsequently, you can use the MyUID field of that Thing to search, sort, retrieve by index, etc

---

<div class="post-metadata">

**Author:** ![phrase9](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/phrase9/32/187478_2.png) [@phrase9](https://forum.bubble.io/u/phrase9)\
**Post date:** [November 23, 2020, 5:34pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/5 "2020-11-23T17:34:25Z")

</div>

Thanks man, I appreciate the breakdown. Will implement this tonight.

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [November 23, 2020, 6:29pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/6 "2020-11-23T18:29:18Z")

</div>

Please note: while the above suggestion points in the right direction, it is not complete and reliable. Please see the following thread for a detailed discussion of how to do this reliably and without collisions in Bubble:

> [@How to achieve Unique, Sequential Numbers Reliably?](http://forum.bubble.io/t/how-to-achieve-unique-sequential-numbers-reliably/81589/57):
>
> boom A WORD OF WARNING THAT SOME OF THE SOLUTIONS PEOPLE OFFERED ABOVE ARE NOT RELIABLE AND YOU MAY, IN FACT, GET DUPLICATES OR WORSE UNLESS YOU USE THE FOLLOWING METHOD AS - I HAVE TESTED THEM ALL JUST LIKE KEITH DID boom Not knowing this caused me a lot of issues and setbacks so I hope it saves others. The solution that works perfectly and reliably in bubble natively is the solution buried at the end of Keith’s great video - and all the reasons are explained by him. in summary the soluti…

---

<div class="post-metadata">

**Author:** ![phrase9](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/phrase9/32/187478_2.png) [@phrase9](https://forum.bubble.io/u/phrase9)\
**Post date:** [November 23, 2020, 8:47pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/7 "2020-11-23T20:47:07Z")

</div>

Thanks Keith, will go through this thread as well before starting

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [February 1, 2021, 2:24pm UTC](https://forum.bubble.io/t/unique-id-for-each-new-data-type-thing/122443/8 "2021-02-01T14:24:54Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
