Formula: DeleteRows()
Category: Action
DeleteRows()
Deletes chosen rows
or stated otherwise...
Hey Coda, please delete the following row(s).
DeleteRows() has one parameter:
Rows
DeleteRows(Rows)
A list of the rows to delete.
One of the largest drains on your doc’s performance are tables with high row counts (normally greater than 10,000 rows). Therefore, creating an automated system to delete old/unnecessary rows is a must.
Whether the above is your reason for deleting rows in your doc via an action or not, it is crucial to understand how to use this action. Let’s look at some common patterns you will be using with DeleteRows().
Deleting all rows from a table
Common in many distributed teams is the idea of a standup—a daily or weekly opportunity for individuals to share what they’re working on. Below is a button titled “Refresh Standup Table” that runs three actions:
Deletes all the rows from the table Adds fresh new rows with a random assortment of people from the company Without DeleteRows() this kind of workflow would not be possible! If you are interested, take a look at the button formula - Its a good one!
Delete only a selection of table
Below is a large database of countries. In this scenario (as is common), the table below was downloaded from a website, but Bob, our astute researcher, only wants the rows where the country is below the equator and in the western hemisphere.
Bob has configured his button below to only delete a selection of his table - aka the countries with a + Lat and Lng value.
Delete a single row from a table
Many times you may want to create a button that merely deletes a single row from a table —specifically the row from which the button was pressed.
Why? There are two main reasons:
You want to lock your doc to prevent accidental deletion of rows or rows in bulk, but you want people to still have that option via a button. Your users are very tech illiterate and need the doc “dummy-proofed” so everything is as easy as possible.
Deleting a selection of rows from a separate table
One especially useful way to use DeleteRows() is when you configure a button in a column to delete an already filtered collection of rows that are related to that row. *NOTE: This can only be done with a formula-configuration of a button - not in the regular UI configuration*
Confused? Lets look at this example: