This would be such a useful feature.
Cannot believe how difficult it is to do this in Airtable
This would be such a useful feature.
Cannot believe how difficult it is to do this in Airtable
Has any better way come up? Also interested in this.
Two years later and no update? In Google Sheets I literally just have a tab with a bunch of hardcoded settings that I refer to in my formulas. Why would this be complicated to do in AirTable?
+1 to interest in this
Yes I need it too. Without it I have to change abot 20 formula by hand every month. Very error prone.
If all of your formulas are in a single table, you can set your constant with a formula field. Then all of the other formulas can refer to that formula field. If you have several constants for that table, make a view that shows the constants for quick reference.
If you need a [Constants] table because the values are used in multiple tables, you can use automations to make sure that every record is linked. Instead of having a new row in the [Constants] table for each value, I recommend placing each value in a new field. That way there is only one record to link.
I ended up with the same solution as @kuovonne suggested, as I needed to be able to update single "constants" and have them available to all automations, whereas many other requests for this feature describe problems that are better solved by related tables.
When creating a constants table, first delete all but one record, then change the table permissions to disallow anyone, including yourself, automations, & forms, from adding or deleting records. Delete the default columns except for maybe a helpful description for the table's purpose as the first field. As you add a field and value for each constant, set its permission so that nobody can edit it, to prevent accidents. You can always unlock it later if you need to change it, then lock it again. Naming fields as if they're JS variables makes them easier to use in scripts later, e.g. someSpecialValue or GREAT_CONSTANT.
To use the constants, add a Find records action to the top of your automation, and Find records based on condition, where it will always be true, e.g. "Where someField is not empty or someField is empty". to guarantee you'll get the record. The result of that action produces results in arrays, so you can add a simple Run script action immediately after the Find, with the following contents:
Object.entries(input.config()).forEach(([k, v]) => {
output.set(k, v[0]);
});
Add each desired constant to the input variables of that script, and its output will then contain "unwrapped" constants.