New to expressions and formulas? Try Expressions: The Essentials.
The Editable_If column constraint may be used to limit the user's ability to edit a column value for a row.
Editable_If is commonly used to only allow column value changes:
- By administrators or specific users, but not others.
- When another column has a specific value.
- When adding a new row, but not when editing an existing one.
- When no value has yet been provided.
The Editable_If Expression
The Editable_If column constraint is a Yes/No expression: if the expression evaluates as TRUE, the user is allowed to edit the column value; if FALSE, the user is not allowed.
As in all column constraint expressions, the Editable_If expression may refer to the current column value using the column value expression,
[_THIS]. For instance, if the current column is Employee Name,
[Employee Name] and
[_THIS] both refer to the same value.
("Admin" = USERROLE()) : Allow only designated app admins. See also USERROLE().
(USEREMAIL() = [Email]) : Allow only if the Email column value matches the current user. See also USEREMAIL().
(NOW() < ([Timestamp] + "024:00:00")) : Allow only if the row is less than a day old. See also NOW().
To set a column's Editable_If column constraint, go to the Data >> Columns tab in the app editor and click on the edit icon next to the desired column:
Scroll down to locate (and, if necessary, expand) the Update Behavior section, which contains the Editable? setting.
Clicking the flask icon to the right will replace the ON/OFF switch with an expression box.
Click in the expression box to enter your Editable_If expression. To remove the Editable_If column constraint, click the X to the right of the expression box.
Scope of Editable_If
The Editable_If column constraint only affects the user's access to the column value, such as when the user interacts with a form view containing the column. The constraint is also checked before allowing access to Quick Edit columns, such as in detail and table views.
Editable_If is consulted only if all of the following are true:
- The table containing the column allows adds or updates.
- The slice containing the column (if applicable) allows adds or updates.
- The column has an Editable_If expression set.
Editable_If can only be used to reduce access; it cannot be used to expand access beyond that allowed by the underlying slice or table.