Aug 08, 2023 10:29 AM
Hello! How are you?
I would like some help with a solution I'm having difficulty finding answers for.
I have a table and I need to generate a unique code (ID), but not based on randomness, rather on a relationship of information within the table itself.
The ID in question should have a format similar to this: YYMMDD + BR + Numerator
Where the numerator should differentiate between identical records, for example:
Suppose on the date 23-08-08 there were 3 records. The code should then be: 230808BR01, 230808BR02, 230808BR03.
Does anyone know how to solve an issue like this?
Aug 08, 2023 12:47 PM
I think the easiest way would be to run an automation when a new row is added (or a checkbox if you want to trigger it yourself), it runs "find record". I would suggest adding a "created time" field and use a condition based on "created "is" today". It will return the number of matching records in the "length" property that were created today. Then run this script with the input variable "length of records" from the search in the previous step:
Aug 08, 2023 05:19 PM
Hello @wallison ,
There are two ways that unique IDs are guaranteed in Airtable: the Autonumber field and the RecordID.
The Autonumber field is a unique value, but is frowned upon by the meticulous, since deletions, etc. will result in missing numbers.
You may also find this guide helpful.
Sequential Numbering of Records · Kuovonne's Guide to Airtable (coda.io)