Automations to delete rows based on time

Hello! I want to optimize my doc and create an automation that deletes rows that are older than 9 months. I’m sure there’s a formula for this but could someone point me in the right direction?

Oh for SURE! Great idea - Doc optimization is always key:

In that realm you have a couple of options depending on the kind of data you are dealing with:
1. Archive that data to preserve it while still speeding up your doc

Options and Resources
  1. @Connor_McCormick1 's archive method
    How to handle large docs (Archive Docs)
  2. My archive method
    How to handle large docs (Archive Docs) - #13 by Scott_Collier-Weir

Both methods will allow you to archive your data but preserve it within your doc allowing you to still query that data and run reports on it.

2. Run an automation to delete your rows
While there are a lot of ways to do this, I would run an automation similar to the following:

  • When: time-based automation that runs every day in the middle of the night
  • Then: deleteRows -
targetTable.filter(date<=(today()-days(60))

That should essentially locate any rows where a date is at least 60 days old and erase it _Dates are a little silly though sometimes and I haven’t tested the exact formula, but should work.

Reach out if you need any more help!

1 Like

Great thank you! This should work though I certainly should have optimized before now as my doc is crashing constantly :sweat_smile:

I will probably do both of these things: archive some and delete some.

Thanks again!

1 Like

In case you are still looking for / working on solution the one below I tested and works. I created a table name Year. This table has a column with all the dates of the year 2021.

the automation runs every day
in my test case 11h AM
the delete action has a filter, the checked check box., see also this blog

the checkbox contains this function:
thisRow.date < Date(Today().Year(),Today().Month() - 9,Today().Day())

I am afraid that for many of us, the time based automations remain confusing due to the way they are set-up.

Enjoy, Christiaan

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.