Jun 25, 2020 07:04 PM
I’m trying to create a single-select field for easier sorting based on a compiled age based on the Birthdate (DOB) column.
Here are my formulas:
Age column:
DATETIME_DIFF(TODAY(),{DOB}, “years”)
Which returns the age of each student.
Age Groups Column:
IF(
{Age} <= 2, ‘PRE-K’,
IF(
{Age} = 3, ‘3-5’,
IF(
{Age} = 4, ‘3-5’,
IF(
{Age} = 5, ‘3-5’
)
)
)
)
Please tell me there is an easier way to do this lol. I want it to autocompile, but I’d like it to be single-select rather than return plain text for the visual aspect with color coding. I hope this makes sense! The “Age Group” column is how I would like it to autocompile, allowing me to delete “Age Groups.” Attaching a photo for reference!
Solved! Go to Solution.
Jun 25, 2020 07:57 PM
Welcome to the community, @arielaronica!
Unfortunately, Airtable provides no way to automatically get a non-formula field (such as a single select field) to update itself, unless you have already grouped all of your records by that field, and then you manually add a new record into the particular group where you want the child’s record to go. In that case, Airtable will helpfully automatically type in the right value for you.
In other words, if you already know in advance what group a new child belongs in — and your records are already grouped — you can manually add a new child into the correct group, and Airtable will add the group value for you.
But that can be a lot of hassle and probably not worth the headache, because you would need to know the child’s group BEFORE you even type in the birthday. You would need to know it before you even type in the child’s name. And then you would have to scroll through your entire list of records (or collapse & expand the groups), just to get to the right group where you would want to add the new child.
So that’s probably not worth the hassle, but maybe it is if you already know the groups ahead of time.
Getting into automation:
You could semi-automate the process of assigning a group to a child with a button field that triggers a JavaScript. You would manually click on a button, and then the JavaScript would figure out what Age Group to select from your single select field. I’m just starting to learn JavaScript myself, so I wouldn’t be able to script that for you, but I’m sure that someone here might be able to help you write a JavaScript for that.
Outside of coding a custom JavaScript, you could turn to the amazing automation tool Integromat, which doesn’t require any programming knowledge, and it can monitor your records for changes to the birthday field.
When a record’s birthday field changes, Integromat will automatically update the Age Group for each record. This would be my preferred way of doing this… it’s easy, it’s quick, it’s free (as long as you stay within their limits for number of records), it’s fully automated, and it doesn’t require any coding knowledge. Integromat is pretty amazing. (BTW, if you have a budget for this project and you need to hire someone to help you setup Integromat, feel free to send me a private message. I am a professional Airtable developer.)
Jun 25, 2020 07:57 PM
Welcome to the community, @arielaronica!
Unfortunately, Airtable provides no way to automatically get a non-formula field (such as a single select field) to update itself, unless you have already grouped all of your records by that field, and then you manually add a new record into the particular group where you want the child’s record to go. In that case, Airtable will helpfully automatically type in the right value for you.
In other words, if you already know in advance what group a new child belongs in — and your records are already grouped — you can manually add a new child into the correct group, and Airtable will add the group value for you.
But that can be a lot of hassle and probably not worth the headache, because you would need to know the child’s group BEFORE you even type in the birthday. You would need to know it before you even type in the child’s name. And then you would have to scroll through your entire list of records (or collapse & expand the groups), just to get to the right group where you would want to add the new child.
So that’s probably not worth the hassle, but maybe it is if you already know the groups ahead of time.
Getting into automation:
You could semi-automate the process of assigning a group to a child with a button field that triggers a JavaScript. You would manually click on a button, and then the JavaScript would figure out what Age Group to select from your single select field. I’m just starting to learn JavaScript myself, so I wouldn’t be able to script that for you, but I’m sure that someone here might be able to help you write a JavaScript for that.
Outside of coding a custom JavaScript, you could turn to the amazing automation tool Integromat, which doesn’t require any programming knowledge, and it can monitor your records for changes to the birthday field.
When a record’s birthday field changes, Integromat will automatically update the Age Group for each record. This would be my preferred way of doing this… it’s easy, it’s quick, it’s free (as long as you stay within their limits for number of records), it’s fully automated, and it doesn’t require any coding knowledge. Integromat is pretty amazing. (BTW, if you have a budget for this project and you need to hire someone to help you setup Integromat, feel free to send me a private message. I am a professional Airtable developer.)