Skip to main content

Conditional Logic-ish Linked Records


TL;DR version: Airtable’s recently added capability to limit linked-record selection to a specific view allows users to incorporate, to a degree, conditional logic.

The specifics: ‘Conditional logic’ can mean a lot of things: Any use of an IF() or SWITCH() statement is a form of conditional logic. Here, I’m using it in what’s become an increasingly common manner: to mean the limiting of available options based on an earlier choice.

For example, take a look at the following diagram.

The user selects one of five categories. Based on that selection, he or she is allowed to choose from a subset of five subcategories, taken from an overall population of 25 subcategories. This conditional restriction of choices not only helps reduce a potentially unwieldy array of options to a smaller, more manageable group, it also helps ensure the subcategory chosen is appropriate given the category already selected.

Admittedly, a 25-element list may not present an insurmountable challenge to the user — even though in the example illustrated, a full 80% of subcategories would be considered invalid for any of the potential categories. Imagine, though, a situation where each category has 25 possible subcategories, or where categories and subcategories consist of model and part numbers: The likelihood for error increases greatly.

Such is the situation this approach is meant to address. While it is far from a universal solution — as the following list of caveats makes clear — it should prove useful in a number of circumstances and use cases.

First, the caveats:

  1. This version of the routines requires all selections be made in the form of linked records. While variations are possible where only the final, limited selection be presented as a linked record, they impose other limitations: namely, that each record of the main table be linked to a single record in the [Control] table for conditional logic to work. The version discussed here and in the referenced base requires only category and subcategory tables to be linked to [Control]; records may be added to the main table without any such preliminary housekeeping.
  2. Currently, there is no way to limit user choice to already-existing linked records; a user may create a new linked record at any selection level. While there are ways to generate an alert should such a thing happen, there is, to my knowledge, no way to prevent it. (Yes, a user entering data from an Airtable form cannot create a new linked record — but see the next entry.)
  3. Perhaps most disappointingly, because of the way Airtable creates records entered from a form view, these routines do not work with forms.

A demonstration base can be found here. To examine the base, open it and duplicate it into your own workspace.

As you can see from the following screenshot, the base contains four tables: [Services] is the main table; [Control] is a one-record table used to manage display of the appropriate subset of subcategories; and [Categories] and [Subcategories] should be self-evident. (For the purposes of this illustration, I’ve borrowed categories and subcategories from MindBodyOnline, a SaaS business-management app for the wellness industry.)

To see conditional limiting in action, create a new record and select a {Category}; you’ll notice your selection mirrored in {ViewControl}. (In normal operations, both {ViewControl} and {Alert:Mismatch} would be hidden fields; I’ve left them visible to illustrate the underlying mechanism.) Next, select the ‘+’ in {Subcategory} and review the possible choices — but close the linked-record popup without selecting a subcategory. Delete your {Category} choice and select a different category. Now, when you go to add a {Subcategory}, your options will have changed.

If you select a {Subcategory} and then change {Category}, in most cases {Alert:Mismatch} will be set to '1' and (for Pro accounts) conditional coloring will flag the record as erroneous. (For all accounts, the {!} field — not shown on the screenshot — will be set to '🔥' to indicate an error.) (I say ‘in most cases’ because some {Subcategory}s are valid for more than one {Category}; 'Botox', for instance, is a valid subcategory of both 'Face treatments' and 'Med spa'.)

Details: The routines are largely self-explanatory. The only bit of trickery involved is using a single {Control} record to track the current record’s {Category} setting. The routine assumes only the record presently being edited will have a linked {Category} with no linked {Subcategory}, and sets the value of {ViewControl} accordingly. From there, a chain of rollup fields is used to pass along the current {Category}, eventually resulting in {Subcategories::DynamicFilter} being set to '1'. The value of {DynamicFilter} is used to determine which [Subcategories] records are visible in the <Subcategories::FilteredSelect> view — which, in turn, determines which {Subcategories} may be selected from [Services].

32 replies

  • Author
  • Inspiring
  • 1386 replies
  • March 28, 2019

I’ve published a base that demonstrates 3-step conditional logic here.

Selecting {Type} limits {Categories}; selecting {Categories} limits {Subcategories}


  1. Thanx and a tip of the hat to MindBodyOnline, a SaaS business-management app for the wellness industry, for their collection of categories and subcategories pertaining to beauty-, fitness-, and wellness-related services.

That’s some wonderful tablecrafting. Thanks so much for sharing! :thumbs_up:


  • New Participant
  • 1 reply
  • April 12, 2019

good job,
wish there was built-in sub category feature…


  • New Participant
  • 2 replies
  • June 29, 2019

That is just great. Thanks @W_Vann_Hall

What do you guys of the Airtable-Support think: Will this be displayable and thus usable in Form-View any time soon?

Eagerly awaiting word.


  • Author
  • Inspiring
  • 1386 replies
  • July 1, 2019
agg_kafer wrote:

That is just great. Thanks @W_Vann_Hall

What do you guys of the Airtable-Support think: Will this be displayable and thus usable in Form-View any time soon?

Eagerly awaiting word.


I doubt you’ll see it available through this method in forms any time soon, as that would require a bottom-up re-engineering of how forms operate. For more info, see this earlier comment.


  • Inspiring
  • 22 replies
  • September 28, 2019

This is a pretty good work around and thanks so much for sharing. I attempted to use this and I found another caveat you may want to mention. The subcategory will become blank after you select the “+” (with no choices available to select) if more than one category has been selected before the subcategory is chosen. This is because the filtered view of the Subcategories table is looking to the Control table rollup that is ultimately from the Main table, ViewControl field. If more than one category is selected, there will be multiple categories in the Control table rollup, leading to no match on the Subcategories table, therefore every record is filtered out. Wow, that was a twisted explanation, but I hope you can follow. I only found this out because our workflow has one person put in all the categories before another person puts in the subcategory information.

Boy, I hope Airtable is working on this. It is really making my payment harder and harder to make.


  • Author
  • Inspiring
  • 1386 replies
  • September 29, 2019
Josh_Cooper wrote:

This is a pretty good work around and thanks so much for sharing. I attempted to use this and I found another caveat you may want to mention. The subcategory will become blank after you select the “+” (with no choices available to select) if more than one category has been selected before the subcategory is chosen. This is because the filtered view of the Subcategories table is looking to the Control table rollup that is ultimately from the Main table, ViewControl field. If more than one category is selected, there will be multiple categories in the Control table rollup, leading to no match on the Subcategories table, therefore every record is filtered out. Wow, that was a twisted explanation, but I hope you can follow. I only found this out because our workflow has one person put in all the categories before another person puts in the subcategory information.

Boy, I hope Airtable is working on this. It is really making my payment harder and harder to make.


Good catch – thanks!

Yeah, there are ways to set up per-record conditional choices, but they all require each new record in the main table — [Services] in the demo — to be linked to the single record in [Control]. (Assuming that would even work; I’d have to think a bit more about it.) I built it this way so that the link-every-record-in-a-table-to-one-record-in-another-table overhead takes place only during category/subcategory definition, rather than during data entry. I have to admit, your process never even occurred to me; I’ll update the documentation with the needed caveat.


  • Participating Frequently
  • 6 replies
  • March 30, 2020
W_Vann_Hall wrote:

Good catch – thanks!

Yeah, there are ways to set up per-record conditional choices, but they all require each new record in the main table — [Services] in the demo — to be linked to the single record in [Control]. (Assuming that would even work; I’d have to think a bit more about it.) I built it this way so that the link-every-record-in-a-table-to-one-record-in-another-table overhead takes place only during category/subcategory definition, rather than during data entry. I have to admit, your process never even occurred to me; I’ll update the documentation with the needed caveat.


Good afternoon,

Thank you very much for the base you created. However, I am having the same problem as Josh. Has anybody found a solution?


  • Inspiring
  • 22 replies
  • April 9, 2020
Victor_Proust wrote:

Good afternoon,

Thank you very much for the base you created. However, I am having the same problem as Josh. Has anybody found a solution?


Hi Victor,

Unfortunately, I have not. We came up with a workaround. Basically we have several single selects with almost the same name and different views created for different circumstances, essentially filtering the dropdown based on view choice instead of the choice made in a single select. This was the best we could do and maintain data integrity.

I really hope this is in the long term plan for Airtable!!


  • Participating Frequently
  • 5 replies
  • May 8, 2020

Hello guys, I’ve also been looking for a way to do this conditional selection with categories and sub-categories.

Here’s my take on it which is working but might be hard to main if you have a lot of categories and sub-categories: Dynamic Drop down dependent on another dropdown

Let me know if it helps or how we can improve this.


Hi everyone!

I am tackling this same issue, but on steroids. My problem is that categories in my case have 4 steps or sometimes 5 steps (category - subcategory - subsubcategory - sub^3 category - and sometimes sub^4 category) so @W_Vann_Hall 's solution is hard to use. Also, I need a record to be linked to more than one category, which current examples don’t allow. One way could be to use conditional form fields, but the total number of valid combinations throughout all my categories is 1263, so it would take forever to set up. Is there a way to upload a spreadsheet or file so that the conditional form fields are created automatically? Making that many filtered views/new sheets is also impractical. Is there a way to solve my problem?

I have all the 1263 possible combinations arranged in a table with fields headings {category}, {subcategory}, {sub subcategory}, etc. So maybe we could start from there.

Thanks!


Welcome to the community, @Diego_Angel_Hakim! :grinning_face_with_big_eyes:

I’m afraid not. Airtable doesn’t yet provide any back-door tools for setting up conditional form fields. The other possible hiccup there is that conditional form fields only control which fields are visible in the form. They don’t control any settings within those fields (like choosing a specific view in a linked table, or changing single-select options).


  • New Participant
  • 3 replies
  • July 10, 2020
W_Vann_Hall wrote:

I’ve published a base that demonstrates 3-step conditional logic here.

Selecting {Type} limits {Categories}; selecting {Categories} limits {Subcategories}


  1. Thanx and a tip of the hat to MindBodyOnline, a SaaS business-management app for the wellness industry, for their collection of categories and subcategories pertaining to beauty-, fitness-, and wellness-related services.

Hey! This is a great solution, exactly what we wanted to make data entry easier for our team. I tried using this conditional logic-ish linked records exactly how it’s done in the base you shared. But when I try to enter something in the Subcategory field in my table, it says “No matching records from FilteredSelect”

I’m not sure what I’m doing wrong. Can you help?!


W_Vann_Hall wrote:

I’ve published a base that demonstrates 3-step conditional logic here.

Selecting {Type} limits {Categories}; selecting {Categories} limits {Subcategories}


  1. Thanx and a tip of the hat to MindBodyOnline, a SaaS business-management app for the wellness industry, for their collection of categories and subcategories pertaining to beauty-, fitness-, and wellness-related services.

@W_Vann_Hall Is it possible to allow multiple selection on the last step the subcategory?

I altered that field to allow linking to multiple records but as soon as I select the 1st category the rest are filtered out.

Any ideas?

Thank you!


  • New Participant
  • 1 reply
  • August 26, 2020

Thank you very much for this explanation. I used your demo 2 days ago and it worked well (after copying it in my base). But, today, the filter for the “category” and “subcategory” remains empty after selecting the “type” level on the “services” tab. I don’t understand why…
Do you have any idea ?
Did you eventually change any function or settings meanwhile ?


Dean_Arnold
  • Inspiring
  • 44 replies
  • January 19, 2021

Thanks @W_Vann_Hall ! I re-created the fields within an existing base and it works great! Admittedly, I don’t fully understand the logic. Will this solution get screwy if multiple users start adding records at the same time?


  • Inspiring
  • 368 replies
  • June 15, 2021

If anyone is interested in a less technical solution, we’ve added this feature to our form recently. You can now dynamically filter linked fields.


  • New Participant
  • 1 reply
  • September 15, 2021

Is it in some way possible to restructure this so it’s possible to choose multiple linked records after its filtered based on the first linked record selection?

I’m working on creating this with Year as the first Linked Record and I want to filter it so I can choose Weeks “attached” to Year 2021, but I want to be able to select multiple weeks. The reason for this is that sometimes the record will be available for multiple weeks, and the base should run for multiple years.


  • Known Participant
  • 13 replies
  • January 30, 2022

@Jordan_Scott1 We desperately need this feature as the current workaround is too hard to maintain. Any updates on this?

It seems like this is the most important feature for both new and seasoned users since almost every contact or credit card authorization requires this sort of input scoping. I would love it if I could filter both directions. Imagine if filling in State, City or Zipcode narrowed any of the three related fields by partial or full entries. We have projects where we would love to set this up on hundreds of related fields. Isn’t this the real answer to boosting user adoption? Consultants can wow clients and the database could error check itself across multiple factors of data validation?

Imagine if typing the City narrowed the states and zipcodes or typing partial zipcodes narrowed the cities and states or typing states narrowed the cities and their codes. I think this feature alone would make Airtable a more central app over others that will never think to do this. There would be so many uses for this kind of inout control.


siliceous
  • Inspiring
  • 23 replies
  • February 15, 2022

Hi all,

I am just wondering is this still works. I have just tried implementing it and it isn’t working for me. When selecting the “Category”, all “Subcategories” display instead of the ones associated with that category.

I copied the base and set up all fields according to the base. The only thing that works is the Mismatch Alert when I select a subcategory that doesn’t belong to the category.


Karlstens
  • Inspiring
  • 601 replies
  • June 25, 2022

@Scott_White and @Tim_Deng - this is what the majority of us are really, really needing. I would guess that this one feature alone - Conditional Linked Records - prevents Airtable from being adopted by countless manufacturers to help manage and process products.


Karlstens
  • Inspiring
  • 601 replies
  • August 4, 2022
siliceous wrote:

Hi all,

I am just wondering is this still works. I have just tried implementing it and it isn’t working for me. When selecting the “Category”, all “Subcategories” display instead of the ones associated with that category.

I copied the base and set up all fields according to the base. The only thing that works is the Mismatch Alert when I select a subcategory that doesn’t belong to the category.


I’ve checked the base just now, and it still works - but the overhead needed to create/support this base is simply unspeakable - and the biggest problem is that it only works with one entry at a time. If you half complete one record, and then start another, all field selections fail.


Is there a way to use this workaround not having dependant fields but based on the value of a common field?
I have 3 tables with a field in common (to manage compatibility). This field in common is a "linked to record" field.
I have another table (a master one) with the 3 previous tables as "linked to record" fields.
I want to be able to filter any of the 3 fields based on the common field (the field can exist in the master table too, that's not a problem).
It can't be done with views because I want it dynamic and it can't be interdependant because each of the 3 fields are optional.

I tried to use this workaround but it's a pain to use in my case and if a field remains empty, the whole thing is not working anymore.

It's a challenge, but I don't figure out how to get it.
Today I'm just considering not using Airtable while they don't give us the ability to filter "linked to record" (and not use views) or to update views through automations when a field has been filled.


  • New Participant
  • 1 reply
  • January 11, 2023
W_Vann_Hall wrote:

I’ve published a base that demonstrates 3-step conditional logic here.

Selecting {Type} limits {Categories}; selecting {Categories} limits {Subcategories}


  1. Thanx and a tip of the hat to MindBodyOnline, a SaaS business-management app for the wellness industry, for their collection of categories and subcategories pertaining to beauty-, fitness-, and wellness-related services.

This is excellent thank you.


  • Participating Frequently
  • 8 replies
  • February 28, 2023

Greetings W_Vann_Hall!

I used your 3 step conditional logic demo (great work by the way) to fill out with the informations a need to be conditional at my company.
Now I am trying to make a form view out of this were the respondent can only choose a subcategory based on a category choosen. However this is not working at all, when I open the form, I have all options to be selected and not only the ones I inteend to see.

Do you have any idea/solution for this case?

 


Reply