What is the Filter formula?

The Filter formula allows you to tell Coda exactly what part of your tables you want to work with. You can use this in tables and canvas both. Let's see how this looks in action:

Let's calculate the number of produce items with a canvas formula:

[Groceries].Filter(Department="Produce").Count()

What if we want to create a list of these items?

[Groceries].Filter(Department="Produce").Item.BulletedList()

Connecting tables with the Filter formula

You can also connect table data together using a combination of the Filter and thisRow formulas. For example, maybe I want a summary table that shows the items we have in each grocery department. 

To start, we'll go to the column settings to create a table from the values in the Department column.


Then, we'll add a new column to the Department table and use this formula:

[Groceries].Filter(thisRow=Department).Item.BulletedList() 

Because the Department column is a Lookup column type, what this means is it's essentially pulling the full row from Department in every time it appears in the Groceries table. That's why, within the filter, you'll compare thisRow in the Department table to Department in the Groceries table. You're comparing rows to rows, and this value match is important for the Filter formula.

If you're ever unsure of the value you're working with, check out the symbol to the right of the value name in a formula. In the above formula, you see we're using a table called Groceries, two row values (thisRow and Department), and a list of text Items (denoted by the stack of values).


Did this answer your question?