Clear all rows in table

i have a coda doc to generate a grocery list given selected meals, everything works well but the grocery list fills into a table and each week i have to manually delete all rows in the table then click a generate button to add the new ingredients,amounts, etc into the table. how would i add an action to the button that deleted all rows in the table first, then moved on?

hi @Shikhar_Srivastava , welcome to the community.

It always helps to have an example, but let’s try it first a bit dry.
the easiest way s to create a canvas button that deletes all the rows like below

but maybe you only want to clear the table on certain dates, let’s assume you want to start on Monday with an empty table, then you can use an automation that runs every morning, but only on Monday is active and it deletes the rows.

I am living in a part of the world we believe that Monday and not Sunday is the first day of the week, so the code in the disable part would be:

Today().Weekday().Contains(1).Not()

the automation runs every day, but only on Monday it ‘will work’.

hope it helps, Christiaan

2 Likes

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