Help

Delete Data Daily

677 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Todd_Robbins
4 - Data Explorer
4 - Data Explorer

Is there a way for tables data to clear at a certain time each day automatically?

3 Replies 3

Sure can, but you'll always need a scripting action to run the deletion.

For a simple table that looks like this;

Karlstens_2-1671137566662.png

We can delete an array of records by using;

deleteRecordsAsync()

The code may look something like this;

 

const {deleteRecordIds} = input.config();
const table = base.getTable("Delete Records");

await table.deleteRecordsAsync(deleteRecordIds);

 

With the input of records to delete array coming from the no-code action "Find Records";

Karlstens_0-1671137475188.png

The Automation can be set to run on a time, find records that meet your deletion criteria, and delete them.

Karlstens_1-1671137520087.png

Deleting records in one big batch has the major advantage of being easily recovered from the trash with one click;

Karlstens_3-1671137687049.png

 

 

The system that @Karlstens wrote will only work if there are less than 50 records to delete. This is due to two issues:

- The "deleteRecordsAsync" function only accepts a maximum of 50 records.

- The "Find Records" action can find a maximum of 100 records.

Instead, if you want a low code solution, I recommend having a filtered view that shows only the records to. be deleted, and then run a script that deletes all the records in the view. A couple of different versions of such a script have been posted on the forums in the past. I am not able to search for them since the change to the new forum platform, but I am on a mobile device. If you are able to search for them, could you please add the link in a reply to this topic? That will help future users who might have the same question.

I can't find the old topic