Help

Automatically Generating and Assigning Unique Codes in Airtable Scripting Block

Topic Labels: Automations
679 1
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnorena
4 - Data Explorer
4 - Data Explorer

Hi Airtable community! New user here,

I am working with three tables in Airtable: 'Families,' 'Codes,' and 'Vases.' Each family in the 'Families' table can have multiple codes in the 'Codes' table, and each code in the codes table can have multiple vases in the third table. The objective is, for each new record, to automatically generate and assign unique codes for each family in the 'Codes' table and each code in the 'Vases' table. When assigning a new code, Airtable should automatically tell me the last code used for that family and assign the next one (for example if xxx-1 exists already, then assign xxx-2) The code format should include the family number followed by a numeric increasing value (e.g., 1, 2, 3). The count should reset for each family, ensuring that each family has its sequence of code numbers. The goal is to implement script in the Airtable Scripting Block that triggers whenever a new record is created on the codes and vases table, ensuring the proper assignment of these unique codes based on the family they belong to.

Maybe my Scripting block approach is wrong and perhaps the problem is easier to fix than what i think the solution is, Any help would be amazing.

 

Thank you!

1 Reply 1
dilipborad
9 - Sun
9 - Sun

Hello @danielnorena 

If you need your unique data in the Primary Field(first field). Then using a formula and combining multiple fields of data with a specific format makes more sense.

Check these references

  1. Using Formulas in Airtable & Primary Field | Airtable Support
  2. Understanding the Primary Field in Airtable - YouTube
  3. Why You Need a Unique Identifier and Primary Fields in Airtable - YouTube

If you need to apply things on other regular fields then you can also use the same formulas and just construct it.

👍