Formula to check if a certain record exists

8452 10
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi everyone,
I have a table that has a list of people. There’s a field called “parents”.
I want to create a view on that table that shows only people without children. To do that, I’d use a formula that checks if the person is present on the “parents” field of any record. If the result is false, it means the person is without children.
The problem is that I can’t figure out how formulas can use values from other records. I’m proficient in SQL and to do that I would use the clause "WHERE NOT EXISTS ".

Does anyone have an idea on how to do that?

10 Replies 10

I think you need an extra Table (maybe Parenthood), because you can’t get the number childs from the same table, I mean with a Lookup.

An example


Captura de pantalla 2018-09-24_03-47-39_p. m..png


Captura de pantalla 2018-09-24_03-47-59_p. m..png

And then you could create a View with the desired Filter:

Captura de pantalla 2018-09-24_03-48-57_p. m..png

5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks Elias for taking the time to explain this to me!
Actually this is a very clever trick, but I fear it stops working if I also want grandparents and grandchildren. We would need to add another level of indirection (another table).
That’s because Airtable lacks what in relational databases are called “self joins”, and so recursion is not possible.

Easy! The relation is the same, you only need to add fields for the needed levels.


Captura de pantalla 2018-09-29_03-39-35_p. m..png

Airtable does support self-joins. However, it doesn’t support reciprocal self-joins, so you’d have to make explicit links both ways. Also, neither of the traditional linked-record field types (rollup, lookup) can be used on self-joins, so you’re limited to retrieving the names of the linked records — which in your case looks as if might be sufficient.

5 - Automation Enthusiast
5 - Automation Enthusiast

@Elias_Gomez_Sainz I just noticed a thing while recreating your example.

Are these steps correct?
(1) adding Marie, Peter, Sandra in People table
(2) adding Sandra > Marie and Peter > Marie records in Relations table
(3) modifying parents field of Marie in People with a reference to records Sandra > Marie and Peter > Marie
(4) modifying children field of Peter and Sandra in People, adding a reference to Sandra > Marie and Peter > Marie

I feel there’s duplication of information while performing steps 3 and 4, because the relationship between these three people is already expressed in step 2.
This could lead to inconsistencies in information stored in the database if someone makes a mistake or forgets steps 3 and 4.

Am I forgetting something?

5 - Automation Enthusiast
5 - Automation Enthusiast

Has anyone read this post?

I did just now :winking_face:

Airtable allows lookups on self-joins now:

This should eliminate the need to perform steps 3 and 4 above. Instead, perform a lookup One way or the other, either to see who the parents are (if you joined children to parents), or to see who the children are (if you joined parents to children).

5 - Automation Enthusiast
5 - Automation Enthusiast

@Jeremy_Oglesby that’s great news! Airtable has made a significant step in the right direction with this feature!