How to create unique ID which never repeats again?

I am making a form of students in which I need unique Id for every form which starts from any number and next number will be 1 added to previous one.I am using firebase and Airtable for this but unable to do… Please help me in this…

1 Like

Use mobile number… Use firebase authentication to verify…
& you said adding + 1 to next number is also possible in firebase… You just need a simple logic…

You can do this with logic block. And if you want to get a unique id which randomly choosen. You can use the random integer block.

Create a var NextID.
Set it to any number you wish.
Each time you add a new student assign NextID to him.
Set NextID=NextID+1
On exit save NextID to Firebase.
On start app load NextID from Firebase.


Can you please share me blocks for this

I need only Natural number starting from 1 and the next number would be 2 and so on…

1 Like

I do not use Firebase so far. I made a simple example with Tiny_DB.

UniqueID.aia (1.4 MB)

1 Like

How to do this same with Air table?

Sorry, I haven’t use Air table so far.
Whenever in my example you see Tiny_DB, you load/save to Air table.
When procedure call MyComment is, you add your own blocks to save to Air table all student’s properties you need (Name, address, phone…, of course the var NextID).

1 Like

Ok Thanks … Let me try it.

1 Like

If I want 'When Screen initialize Automatic Number (Starting from 1 ) will appear on the screen and again when screen will open number next to first number will appear.
How to do that kindly help me.

Just copy a block.

Is this possible- When screen initialize automatic a number (starting fro 1) will generate and that number be shown on screen , when again screen initialize next number (i.e. 2) will appear on screen
please help me in creating this
you are very helpful thanks in Advance.

May be I cannot understand what you mean.
With the 2nd set of blocks, each time screen initializes, var NextID is loaded from a db. This is displayed to label lbShow.

Lets follow this scenario:
The very first time you start app this is 1.
If during the first run you add NO ONE student, remains 1. Saved as 1.
Next running shows 1 again.
If during next run you add 3 students, they have IDs 1, 2, 3. Then NextID has a value of 4, which will be saved when exit.
Next running it will show 4.

Hope this is helpful.

I dont want to add any thing on button click. What I just want do is like a form number each form will have its own number and that number will generates on its own when screen ititialize and the number which is generated should be displayed and no one can edit it. And when the screen Reopens next number will auto generate and same process occur again.
Hope you understand
Thanks :blush:

Your screen will have a single form which will display a certain student’s properties or you need to create a separate form for each new student named Form1, Form2, Form3 etc?

In my Form students will fill there details and details would be store in Air table
I had made login and sign up page too in which each student will fill his own details no need to form NUMBER OF FORMS I.E.1,2,3 ETC

So, the principle of your app is a central db (Air table) where many users will have access to fill their data. The central system must give a unique ID to each one, and that ID will be +1 for each new student.

ya I need this but unable to set blocks for this. please help me in setting blocks

As far as I know Tiny_DB has not such a property to communicate with more than one user. May Air table can do that, but -as I said- I didn’t use it so far.

I presented just a simple routine to produce a unique ID for one-to-one user.
May be comment of @Alapjeet about firebase would be better.
Sorry if I cannot help your project.

1 Like