Skip to main content
Solved

Formula on 2 linked tables

  • October 16, 2019
  • 3 replies
  • 21 views

Forum|alt.badge.img+8
  • Known Participant

Hi, dear pros,
can I ask, anyway that I can realize this:
table A: tasks
table B: doctors

if a linked filed from table B writes on table A: for instance: Dr. Brown, i want to have another field on table A can show something like “Health”

not sure how to write formula on something linked to another table

Best answer by Justin_Barrett

I think I wasn’t clear.
OK, I have 3 tables
Table A: Doctors
Table B: Tasks
Table C: Major

I want to make Table B has a filed that If any one from Table A linked to Table C, then one field on Table B can write “Professional”, otherwise “amateurish”

The basic idea is, if any doctor has any linked field on table c, the table A can tell, their opinion is professional.
something like this.

@Justin_Barrett


In that case, I would put the formula field into your [Doctors] table. Name it something like {Professional/Amateur}, and use this formula:

IF({Link to Major}, "Professional", "Amateur")

Replace {Link to Major} with the name of your field that links to the [Major] table. This formula will mark each doctor’s record appropriately based on whether or not they have any links to that table.

In any other table that links to a doctor, like it sounds your [Tasks] table does, you can look up that professional/amateur status with a Lookup field:

3 replies

Justin_Barrett
Forum|alt.badge.img+21

If I understand your example correctly, you have a link field named something like {Doctor} in your [Tasks] table, and it points to the [Doctors] table. When making a link to a record named “Dr Brown”, you want a different [Tasks] table field to display “Health”. Am I reading that correctly?

If so, that’s a pretty easy formula. With a single link in a link field, Airtable simply reads the contents (the primary field value from the linked record) as a string, so you just need to compare that string to another string in your formula:

IF({Doctor}="Dr. Brown", "Health")

Does that work for your needs?


Forum|alt.badge.img+8
  • Author
  • Known Participant
  • October 22, 2019

If I understand your example correctly, you have a link field named something like {Doctor} in your [Tasks] table, and it points to the [Doctors] table. When making a link to a record named “Dr Brown”, you want a different [Tasks] table field to display “Health”. Am I reading that correctly?

If so, that’s a pretty easy formula. With a single link in a link field, Airtable simply reads the contents (the primary field value from the linked record) as a string, so you just need to compare that string to another string in your formula:

IF({Doctor}="Dr. Brown", "Health")

Does that work for your needs?


I think I wasn’t clear.
OK, I have 3 tables
Table A: Doctors
Table B: Tasks
Table C: Major

I want to make Table B has a filed that If any one from Table A linked to Table C, then one field on Table B can write “Professional”, otherwise “amateurish”

The basic idea is, if any doctor has any linked field on table c, the table A can tell, their opinion is professional.
something like this.

@Justin_Barrett


Justin_Barrett
Forum|alt.badge.img+21
  • Inspiring
  • Answer
  • October 22, 2019

I think I wasn’t clear.
OK, I have 3 tables
Table A: Doctors
Table B: Tasks
Table C: Major

I want to make Table B has a filed that If any one from Table A linked to Table C, then one field on Table B can write “Professional”, otherwise “amateurish”

The basic idea is, if any doctor has any linked field on table c, the table A can tell, their opinion is professional.
something like this.

@Justin_Barrett


In that case, I would put the formula field into your [Doctors] table. Name it something like {Professional/Amateur}, and use this formula:

IF({Link to Major}, "Professional", "Amateur")

Replace {Link to Major} with the name of your field that links to the [Major] table. This formula will mark each doctor’s record appropriately based on whether or not they have any links to that table.

In any other table that links to a doctor, like it sounds your [Tasks] table does, you can look up that professional/amateur status with a Lookup field: