Inside this article
We've already covered what Controls are and how to filter your table. But what if you want to combine the convenience of controls with the power of filtering your table? In this article, we'll cover a few ways to do just that.
Using the interactive filter from the column menu
Interactive filters refer to Coda's ability to select an appropriate filter depending upon the column type. This approach is great if you want to set up a filter quickly without much fuss.
To use interactive filters:
right click on any column
scroll to "Filter" and then select "Interactive Filter"
then select "add control"
You just created a control that can filter your data! Coda has already set up the filter and connected it to the control for you. No further setup needed. Here's an example of the above flow in action:
Curious about the logic of the filter? Check out the filter in the same way you would a normal table filter! Click on the "Filter" button above the table and then click on the kebab (the "..." but vertical) and then click "show formula". The gif below shows how to do this.
The control that gets created depends on the type of column. So in the above example, where we create an interactive filter based on a text column, Coda generated a text input control. What about currency columns? Or select list columns? Watch how in the gif below Coda generates a slider control for currency columns and a select list control for a select list column type (and allows you to use both concurrently!):
Try it out on other columns to see what other controls get populated!
But what if you don't like the control that the interactive filter generated, and want to set up your own? Maybe with your own logic for filtering? Read on!
Setting up your own control with your own filter logic
Interactive filters are nice because they do all the heavy lifting when it comes to creating the control and writing the logic. But sometimes you'll disagree with the resulting setup and wish it worked differently. Now, we'll show you how to set up your own filters with the controls and logic you want!
Before we begin, it helps to have:
a table with values (otherwise, what are you going to filter?)
an idea of how you want to filter the table
an idea of what controls exist (feel free to type /control and select the different options to get a sense of what's out there!)
Broadly speaking, setting up a control to filter a table or view is a two-step process:
Setting up the control
Hooking it up to your table filter
Let's start with setting up the control. Assuming you know what controls are and how to set them up, it's pretty fast: give it a name and designate what values are selectable for the control. If you need to refresh your knowledge of controls, check out steps 1 and 2 of this article. Feel free to also watch the gif below.
Sweet, you now have a control. Now how do we hook it up to your table filter?
Navigate to the table you want to be filtered by the control.
Hover over it, and then click the "Filter" button above it.
From here click "Add Filter" and then the kebab where you'll hit "show formula". You'll notice you can still click the "Add Filter" button below in case you want to add more filter criteria outside of this formula one.
Click into the new box that appears, turns out it's a formula editor window!
From here, you'll want to write a formula that references the control you're using. This is a good time to remember the name you gave to the control so you can reference it in the formula. The below gif shows the steps above:
In this example since I was comparing numbers, I wrote a simple formula treat the number in the "Budget Max" control as the maximum value; the table should be filtered to only show rows where the "Budget" value is less than the number in the control.
Alternatively, you can click the cursive "f" at the top to open the formula editor. The cursive "f" option is better if you know you're going to write a longer and more complex filter formula.
And that's it! Now you can easily filter your tables without having to navigate to the table filter every time.
This article used some simpler examples but if you're curious about what others have done, feel free to check out our community, the Gallery and our Youtube Channel! Or reach out to support via the bubble in the bottom right of your screen to speak to real human (after our bot asks some helpful questions :} ).
Note: When you use a control to filter data, the filtered view of your data will be visible to all doc collaborators. If you’d like an easy way to clear your filters or set a default value, you can configure buttons or automations with the “Set control value” function.