How can I implement such a formula in Airtable?
// all fields in an Airtable table
const allFields = [
{
key: 'type',
value: 'TypeOne',
}
{
key: 'name',
value: 'Some name',
},
{
key: 'description',
value: '',
},
]
// set in a field of the table
const requiredFields = [
{
type: 'TypeOne',
requiredFields: ['name', 'description'],
},
{
type: 'TypeTwo',
requiredFields: ['name'],
},
]
let invalid = 0
for (let i in requiredFields) {
if (!allFields[requiredFields[i]]) invalid += 1
}
if (invalid) return '⚠️ Some fields are not filled out!'
For now, I have to do something like:
IF(type = 'TypeOne', IF(OR(name = 0, description = 0), '⚠️ Some fields are not filled out!'))
& IF(type = 'TypeTwo', IF(OR(name = 0), '⚠️ Some fields are not filled out!'))
But I would like to set just an array of required fields but I don’t know how to dynamically set a variable like at this point allFields[requiredFields[i]] (not a value of some predefined variable but a variable itself).

