Hi, I am fairly new to Airtable, so I am trying to learn how to do things more efficiently.
I have a question about formulas.
Is there a way to select a field based on an input without using the SWITCH() function? I’m thinking something like a FIELD_SELECTOR() (← this a made up function as far as I know, but maybe something like it exists?), where I input the text display_name of a field, and output the value for that field. Or is this something where I need to start learning how to integrate python, and airtable built-in functions are not powerful enough?
Example:
I am making a database with taxonomic information (ie. latin names of living things). I have all the taxonomic ranks from Phylum to Species as separate fields. I have a field called taxonomic_rank
that indicates the lowest taxonomic rank in the row. I want to make a function to create a display name that outputs “taxonomy_name taxonomic_rank”. So functionally, A row that says Arthropoda in Phylum and nothing in the lower ranks would output “Arthropoda Phylum”, and a row that says Arthropoda in Phylum and Arachnida in Class but nothing in the lower ranks would output “Arachnida Class”, and so on.
I think I could do this with the following formula:
SWITCH(
{taxonomic_rank},
'Phylum',{Phylum},
'Class',{Class},
'Order',{Order},
...
'Species',{Species},
'invalid')
& ' ' & {taxonomic_rank}
But wow, it would save me so much time if I could do something like this (see above for description of my made up function):
FIELD_SELECTOR({taxonomic_rank}) & ‘ ‘ & {taxonomic_rank}