Help

Re: Looking for someone create a random 4 numeric digits

3906 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Xing
6 - Interface Innovator
6 - Interface Innovator

Hi, I want to post a job that I’m looking for someone we can create us a solution that we can have a random 4 numeric digits, that we want to have a random unique combination of four digits, the “0” ( or “00”, “000”) can not be in the beginning, in practical, when I create the records on the column, for example “Book” is the first column (primary key in airtable), the records will be “Book 1”, “Book 2”, Book 3"….and I want whenever I create a new records, for instance “Book 4”, there would be generating the random unique combination of four digits automatically on column “ID”, please see the image I’ve attached.

Screen Shot 2018-12-11 at 2.23.38 AM.png

I need some excellent folks to help.
Let’s try to make this happen.

32 Replies 32
Tuur
10 - Mercury
10 - Mercury

Maybe this helps?

Xing
6 - Interface Innovator
6 - Interface Innovator

thank you, I looked this post, but the consequential answers are “impossible”, folks didn’t provide a solution in the end.

If you have an Airtable Pro plan, the batch update block can be used to generate random numbers in number fields. It might not work for your specific use case (since batch update will only generate new numbers when pressed, not automatically) but it might be helpful.
Screen Shot 2018-12-13 at 6.03.06 PM.png

Ha! I had no idea that action existed in the Batch update block!

Thank you, however, I don’t’ think this is the solution I’m looking, 1) this solution would only apply on the existed records, I will be constantly updating the new records, if I press the generating again, all the digits will be re-generated again, I’m using this for the stock needs, so i would want the unique ID for each item permanently…

Ah, I missed the unique part there. Sorry about that!

Xing
6 - Interface Innovator
6 - Interface Innovator

Yes, unique is important

hi @Katherine_Duh , the batch update block cannot provide the unique value:(

The trick is to generate all 1000 random numbers first. After that create a table with an ‘Autonumber’ as the primary field that can be used later for a look up.

Screen Shot 2018-12-14 at 12.58.28 PM.png

Then create 3 fields (that will likely be hidden later) book_autonumber and rand_autonumber just copy the former into the later. Next create ID as a lookup field.

Screen Shot 2018-12-14 at 12.54.26 PM.png

The solution is a little janky and requires an extra table. That said, it seems to accomplish what you need.

ps. I realized you needed to get rid of any number with leading zeros. Just create a filter to find and delete these:

where ID < 1000

[edit: added post script]