- 30 Jun 2022
- 4 Minutes to read
Let's make a base, Part 3 Linking tables
- Updated on 30 Jun 2022
- 4 Minutes to read
By this point, you should be comfortable with entering information into records, customizing field types within a table, and using the view functions to look at records in your tables. Ready for more? Next, we're going to learn how to create relationships between records across different tables. After we’ve created an association between tables, we can use that to get information from the other table. This is called “linking tables.”
For example, if we were looking for apartments, and made a table of different apartments and a table of city districts, we could link each apartment to the city district in which it's located. This would display the name of the district on the same card as the apartment and make it easy to pull up information about the relevant city district at any time. Or, if we were organizing a film collection, we could have a table of film titles and a table of different film genres, and link each film to its associated genre. Or, if we were astronauts exploring the farthest reaches of the galaxy, we could have a table of planets and a table of alien species, and link each alien species to its home planet. The possibilities are endless!
Making a new table
Let's return once again to our mascot recruiting example. Right now, we're recruiting for two open positions within our sportsball franchise. Let's make a new table of positions, so we can link each applicant to the position for which he or she is applying.
To make a new table, tap the "+" button on the table row, in the bottommost right-hand corner. You will then be brought to the "Add Table" menu, and prompted to give your new table a name. (We'll call ours "Positions.")
You also have the option of tapping the "Customize fields" dialog to customize your fields before creating the table. Doing this will allow you to get started on adding in records right away once you create your table. When you're done naming your new table and customizing the fields, tap the "Done" button in the top right-hand corner and you'll be brought to your new field. Notice that there are now two tabs at the bottom of the screen, one of which says "Applicants" and one of which is highlighted and says "Positions." These represent your two tables, and you can switch the table at which you're looking by tapping the desired tab.
Let's go ahead and fill out some of our records.
Making a Link to a Record field
Now that we've made two tables, it's time to link them together using the "Link to a record" field type. This way, we'll be able to see at a glance which mascots are applying for which positions.
Go to the Customize fields menu (either by tapping on the table tab to get to the "Edit table" menu, or by expanding a record and scrolling to the bottom until you find the "Customize fields" button).
From there, let's add a new field with the name "Applicants" and the type Link to a Record.
In the setup options for this field, underneath field type, you can configure the table to which this field will link. You have the option of picking from your existing tables ("Applicants" and "Positions," in this case), or of creating an entirely new table. Let's tap "Applicants," because we want to link the applicant records to each of the position records. Notice that when we tap "Applicants," the name of the field type changes from "Link to a record" to "Link to 'Applicants' table." This lets you know at a glance the specific table to which your field is linked. Neat!
When you're done configuring the new link to "Applicants" table field, tap the Save button in the upper right-hand corner. We're not quite done, yet, though—although we've set up the field, we still have to link the specific applicant records to their matching position records. Return to the main table view, then expand a record and scroll until you find your newly configured linking field. It should have a button in it that says "+ Link to a record in the Applicants table," and look like this:
If you tap the button, it will bring up a new menu showing all of the records in the linked table ("Applicants," in this case). Tap the record you wish to link. There is also a search function available toward the top of the screen to help you find the record you want. Once you've tapped the desired applicant record, it will be linked to the appropriate position record.
Note that by creating this field in the Positions table that links to the Applicants table, a new field in the Applicants table linking to the Positions table has been created automatically. If you have an expanded record for an applicant open and you tap on the link to the position record, it will bring you to that position record; similarly, if you have an expanded record for a position open and you tap on the link to the applicant record, it will bring you to that applicant record.
Congratulations, you've learned most of what you need to learn to make a complete base. But we still haven't yet covered how to use Airtable to collaborate with other people! Let's learn more about working together in Airtable in Let's make a base, Part 4: Collaboration.