Skip to main content

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.

Maybe this helps?




Maybe this helps?






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.



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.



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


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.



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…


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


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


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


Yes, unique is important


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.



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


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…


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



redit: added post script]


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).


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).


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.


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]


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


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]


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?


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?


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.


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?


@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.


@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.




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…




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…


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?


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?


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.


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.


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


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


No problem:



What we are doing is updating the record that was just created. So we need to give it the ‘Record ID’ from ‘Step 1’. (This is the row ID from the new book that was created).



Zapier calls this a ‘custom value’ because you are passing in a value from another step. I suggest reading the help doc to get a better understanding.


No problem:



What we are doing is updating the record that was just created. So we need to give it the ‘Record ID’ from ‘Step 1’. (This is the row ID from the new book that was created).



Zapier calls this a ‘custom value’ because you are passing in a value from another step. I suggest reading the help doc to get a better understanding.


HI @bdelanghe , thanks for your patient, you can imagine that I’m not as PRO as you, I think i’m in the last step of the victory. This “customer value” is really hard to understand.


There are many fields that when I click the dropdown menu are a long mix numeric and digits…do I just need to choose anyone of them? Could you please tell me more about this concept? or if you don’t mind could you please screen shot some images that this is so hard to understand for ppl like me who doens’t understahnd the coding.


@Xing Sent you a message.


Because this was (apparently) taken to private messages, I’m not sure if a solution was ever found to this problem. Whether or not it was, one question I have—which I couldn’t see answered in any of the other comments—is: why does the number have to be random? As long as it matches the other criteria—unique, four digits, and does not begin with 0—does it matter if it’s random vs sequential? If sequential is okay, there’s an easy way to get that. (Just throwing this out there as an alternate solution in case it helps anyone else.)



Make the second field an Autonumber field. Add a third field (ID) that’s a formula:



Autonumber+999



For the first record, its value will be 1000, and each record’s ID will increase from there. Now you can hide the Autonumber field, as you don’t need to see it.


Because this was (apparently) taken to private messages, I’m not sure if a solution was ever found to this problem. Whether or not it was, one question I have—which I couldn’t see answered in any of the other comments—is: why does the number have to be random? As long as it matches the other criteria—unique, four digits, and does not begin with 0—does it matter if it’s random vs sequential? If sequential is okay, there’s an easy way to get that. (Just throwing this out there as an alternate solution in case it helps anyone else.)



Make the second field an Autonumber field. Add a third field (ID) that’s a formula:



Autonumber+999



For the first record, its value will be 1000, and each record’s ID will increase from there. Now you can hide the Autonumber field, as you don’t need to see it.


hi Justin, thanks for your useful message, I’m sure there are some ppl would want to know the reason why I needed the random number.



Here is my situation I’m working on a project which is the inventory and I want all the stock number randomly.



For instance, I have Product A, and 100 pieces of product A, and Product B which is 50 pieces.



I want all the number randomly which the clients can not guess which piece is from A and which piece is from B.



For example, if I have A, 100-199, if the number is randomly, the clients can not know the “internal fact”.


hi Justin, thanks for your useful message, I’m sure there are some ppl would want to know the reason why I needed the random number.



Here is my situation I’m working on a project which is the inventory and I want all the stock number randomly.



For instance, I have Product A, and 100 pieces of product A, and Product B which is 50 pieces.



I want all the number randomly which the clients can not guess which piece is from A and which piece is from B.



For example, if I have A, 100-199, if the number is randomly, the clients can not know the “internal fact”.




Maybe there’s some deeper reason that’s implied in this explanation, but I can’t picture a scenario where I would care about what the client might or might not guess about how products are set up behind the scenes. If you don’t want the client to know how your products are set up, omit the product numbers from any document the client is going to view. In most stock scenarios, stock/product numbers are for internal use only. Even if the end customer/client sees them, they typically don’t care about the product numbering scheme. They care about the product.



Anyway, I’m not trying to dissuade you from going the random number route. I’m just having a hard time understanding the details of your specific situation. No need to explain further, though. If you were able to reach a solution that gave you what you wanted, that’s all that matters.


Reply