Help

Autodelete columns from 500 onwards

Topic Labels: API Scripting
748 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Maurizio_polver
6 - Interface Innovator
6 - Interface Innovator

Hello there,

Everytime an event occurs, a tool add a new record in Airtable. Once added, it's automatically sorted by Creating Time, so the newest one is always on top.

What i need it that if the total rows is 500 and a new record is added on the top, Airtable automatically deletes the number 501 (the oldest one).

If not possible another viable solution would be that the 10th of each month for example, or 2 times a week, Airtable automatically deletes columns from 500 to the end.

Hope you can help, thank you very much!

2 Replies 2
ScottWorld
18 - Pluto
18 - Pluto

You could probably do that with a custom JavaScript, but I don’t know scripting so I would handle that with Make’s automations for Airtable.

In Make’s “search records” module for Airtable, you can specify your search to sort your records in a certain order and to limit the search results to a certain number.

So you could limit your search result to only the single oldest record, and then delete it.

If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread.

For example, here is how you would instantly trigger a Make automation from Airtable.

p.s. If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld 

You can try doing this by:
1. Link all your records to a single record in another table called "Rollup" or something
2. In "Rollup", create a "Count" field to output how many linked records there are,
3. In "Rollup", create a rollup field with "MIN()" to display the earliest "Created time" value
4. In your main data table, create a lookup field to display the value from the field from step 3
5. In your main data table, create a formula field to check the value of the field from step 4 against that record's created time
6. Create an automation that will trigger whenever the "Count" field from step 2 outputs > 500, and its action will be to find the record where the field from step 5 is "True", that is to say, that's the earliest record, and then delete it with a run a script action.  (There are a lot of examples of a run a script action to delete a record in the forums, but
let me know if you can't find any)

Should work!

Deleting records automatically requires the "Run a Script" action I'm afraid, so you'd need a paid account.  If you don't have a paid account you can just use a checkbox to mark it as deleted and then delete all marked checkboxes once a month or something?