Modeling a hierarchy via a self-linking table: auto-compute Parent field from Children field


#1

I’m trying to figure out how to model a hierarchy. The Airtable Beginner’s Guide to Many-to-Many Relationships briefly discusses an example that matches my use case pretty well:

“For example, let’s say that you have a company directory with the names of all of employees: you want to model the relationships between managers and their subordinates, given that each manager manages many employees and each employee has only one manager. To do this, you could create self-linking linked record fields for each individual’s manager and subordinates.”

What I’m trying to figure out: Is there a way to avoid having to specify both Subordinates AND Manager? Both fields are critical to have, but one can be derived from the other. To be more specific: I would like to only specify Subordinates and have the Manager automatically computed. Is this possible in Airtable?


#2

Hi Chris

In Airtable, if you create a Link Field from one table to another, the app creates a field in both tables so that you can see both the one and the many side of the relationship. So for example, if you create a departments table you would be able to see en employee’s department on their record as well as all people in the department on the department record.

However, if you create a self join you only see one side of the join. So you could create either a field for subordinates or a field for manager - and you would not be able to see a manager’s list of employees in the first example. What you could do, though, would be to Group the view by Manager:

This may go some way to solving your issue?

Julian