New to expressions and formulas? Try Expressions: The Essentials
You can also learn more about other types of expressions.
Every column definition has a type that specifies what values are allowed in the column, as well as flags that specify if the column is hidden, if it's required for input, etc. This is adequate for many apps, but sometimes a more dynamic or data-driven mechanism is needed. This is what column constraints provide.
A column constraint is an expression that is dynamically computed to determine the behavior of a specific column when the user tries to enter or change its value.
Three column constraints govern the validity of input values for that column:
- Valid_If: what are acceptable values?
- Required_If: is an empty value acceptable?
- Editable_If: can it be modified at all?
Two further constraints are related to the presentation of the column:
- Show_If: should the column be shown or hidden
- Suggested_Values: a list of values to prompt the user with
To add a column constraint, click the Data > Columns tab and click the Edit icon at the left of the corresponding column definition.
Column constraints give you the power to define very subtle or complex conditions, but users will only see the resulting behavior. As an app creator, it's important to provide adequate explanations for the columns affected by these expressions--particularly for Valid_If conditions--so users will know how to proceed if they provide an invalid column value. The best way to do so is by providing meaningful column descriptions.
When these expressions reference other fields in the row (not just [_THIS]), it's best to ensure they're always "backward" references to fields the user has already seen (meaning columns that come before the column being considered in the spreadsheet and appear above the column being considered in the Columns tab). Conditions containing "forward" references may be confusing to users and may cause problems with multi-page forms.