Inside this article:
Two kinds of lookups
In Coda, there are two primary ways you can connect tables together:
- The Lookup column format
- The Lookup formula
The Lookup column format
You'll use this if you want to create a dropdown menu that pulls information from another table. For example, a list of projects associated with tasks, or objectives associated with key results. To create a lookup column:
- Click the column and choose format column
- Choose the lookup column type
- Select which table you want to pull from
If you don't see the values you expect when you click the dropdown, head to the table you're looking up from and make sure that the display column is set to the column you want. You'll know something is a display column when it has this icon:
To change the display column, click the column dropdown and choose Set as display column:
The Lookup formula
The lookup formula on the other hand, allows you to understand more about items in your tables based on information throughout your doc. For example, I may want to see a list of all the projects associated with a Goal. If you want to slice and dice your data along multiple factors, check out the filter formula.
The lookup formula has three parts:
- The table you want to look at
- The column you want to match
- What you want to match the column to
In the example below, we want to see all of the contacts associated with the Companies:
- For the table, we choose to search in the Contacts table
- We want to look for matches in the Company column (which is a lookup column)
- We choose to match on thisRow (which is the company name we've created a lookup to)
When to use lookup columns versus lookup formulas
Use lookup columns if:
- You're getting ready to create a new table that will have one column in common with an existing table
- You want a dropdown menu of an existing set of information
Use lookup formulas if:
- You want to summarize information in another table
- You want to look up information based on one criteria
Formulas and lookup columns
Since lookup columns pull all of the details about a row, you can actually use formulas with them by typing the column name, a dot (or period), and the value want to pull from the other table.
In the example above, we're saying to show the email address of the Contact.
And, to save you time, you don't even have to type a formula. When you create a new column, you'll see the option to create new columns based on what you already have in the table:
Summarizing table data with lookups and thisRow
One of the most valuable ways to use the lookup formula is to summarize progress or trends in other tables. For example, you may want to know the percent complete on different projects. You'll begin by using a lookup formula to pull the total number of tasks:
Then, you'll use thisRow with filtering to populate the completed tasks. In this case, we're using the Filter formula rather than the lookup formula because we want to cut out data along multiple lines (the project name and the status).
Finally you could calculate the percent complete:
Since lookups pull all of the metadata, you may want to see all of that information in a table view. To do so, open the row by clicking the Expand row icon:
Then click the pencil icon to edit the layout:
Make sure the lookup column is visible and not in the "hidden columns" section.
Finally, toggle on Display as table: