Looking for someone create a random 4 numeric digits


#1

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.

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


#2

Maybe this helps?


#3

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


#4

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.


#5

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


#6

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…


#7

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


#8

Yes, unique is important


#9

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


#10

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.

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.

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]


#11

Why not try using Integromat or Zapier To do this for you - both can generate random numbers (in the latter case in the Formatter / umbers option).


#12

hi Julian, before we come here, we tried everything we can, including Zapier, the PRO supportive team from Zapier confirmed that neither “Storage” nor “Formatter” can perfectly support this function. and I contacted the Airtable, Airtable also confirmed that currently there is no solution, but I can post a thread here to see if some folks can have idea, but again, it seems it’s impossible.


#13

hi @bdelanghe , can you kindly share this base to me, why i can not sucessfully create it which i followed your instructions


#14

hi, @bdelanghe , this sounds like a detour solution, which I really appreciated. but I found a inconvenient, for example, now we are creating Book 5, which after fill out the Primary Key field, we have to manually lookup the “rand_aotonumber” match “5” in order to trigger the “ID”, can this be automatically?


#15

While @bdelanghe’s solution can’t be automated (except through such a 3rd-party integration app as Zapier or Integromat, where time delay may be a factor), the mapping of book_autonumber to rand_autonumber can be performed less obtrusively than with a full manual lookup. For instance, if the two fields are consecutive, the value of book_autonumber can be dragged (using the fill handle into the adjacent rand_autonumber field. Alternatively, the value can be transferred using a quick, three-keystroke sequence (Ctrl-C, right arrow, Ctrl-V). If you don’t need the random value looked up concurrent with the creation of the record, you can wait until the day’s (hour’s, week’s, whatever quantum of time is appropriate for your app) record creation is done and then copy the entire book_autonumber column to the rand_autonumber column by selecting the book_autonumber header, pressing Ctrl-C, selecting the rand_autonumber header, and pressing Ctrl-V. Again, not an optimal solution, but at least a slightly more streamlined UI than manually looking up the applicable rand_autonumber for each record.


#16

@Xing you are correct after you enter the title you will have to copy book_autonumber field to the rand_autonumber field. @W_Vann_Hall offers quite a few quick ways to this. I recommend his last suggestion:

copy the entire book_autonumber column to the rand_autonumber column by selecting the book_autonumber header, pressing Ctrl-C , selecting the rand_autonumber header, and pressing Ctrl-V .

@W_Vann_Hall Also suggested Zapier which is a great tool and could automate this. That said it’d be a bit overkill. Also, it only runs ever 15min which might not be what you want.

I published this base on Airtable Universe for you to check out.


#17

If we’re talking overkill, I thought about mentioning the Airtable->Slack->Zapier->Airtable integration method as likely being the only way to achieve an acceptable response time. It’s not real-time, but it’s as near real-time as you’re likely to get currently. Compared with the other methods of streamlining linked-record creation, though, it’s an overly complex solution for the wrong problem…

AFAIK, Integromat still offers polling cycles of less than 15 minutes (5 minutes? 1 minute?). Unfortunately, if real-time is truly what’s needed, 5 minutes is essentially the same as 15…


#18

hi @W_Vann_Hall, I don’t really care about the minute’s count real-time, if so, can you tell us what’s the solution for automating on the lookup with Integromat or Zapier instead of ctrl-C AND ctrl-v on every time editing?


#19

Hi @Xing. I’d suggest starting a free Zapier account and getting a familiar with it before integrating into your daily workflow. They have a good guide here. If you are familiar with IFTTT it’s similar. In this case, it’s if ‘New Book’ (in view ‘NeedsID’) then add ‘book_autonumber’ to ‘rand_autonumber’ field. This is likely what you are looking for. And I’ve created a ‘trigger’ for my demo base that does that:

The template for the trigger is:

And the template for the action is:

Feel free to recreate this trigger for yourself. I’d also like to note that the free plan would only allow for you to update 80 books per month. If you need more you’ll have to switch to a paid account.

ps. best of luck.


#20

hi @bdelanghe
I have a question on the action on Zapier,

can you specific what’s the value I shall select from the drop down menu? and why we need to select the custom value for record ID at here? thank you