Expressions may be used in various AppSheet features -- Initial Values, App Formulas, Virtual Columns and Column Constraints (Valid_If, Show_If, Required_If, Editable_If) -- to customize app behavior and provide your users with advanced functionality. Expressions in this article align with the Yes/No Expressions in the Expression Builder of the Editor. The Expression Builder can be found anywhere you are able to enter a formula/expression, noted by a little "flask" symbol next to it. Clicking on the flask will bring up the Expression Builder. The Expression Builder is "context-aware," i.e. it shows you expressions that are relevant to the specific table you are editing. Also included in the builder is an "instant" expression checker, to verify that the expression is valid.
Use any of the following values as part of an expression:
- Words, Dates, Times. Highlight all values with "quotes", except for numeric values, e.g. "Value","01/01/2016", "12:00:00" for time, "012:00:00" for duration.
- Numeric values are noted just as they are, e.g 10.
- Name any column using square brackets around the exact column name: [ColumnName]. When combining a [ColumnName] with another value, put the expression in (parentheses). May be used in any expression; however, when used in the Initial Value feature, it may only refer to a separate table.
- Use [_THIS] as a "virtual column name." It refers to the value of the current column (used in Valid_If, Show_If, Required_If, Editable_If conditions).
- Use [_THISROW] as a "virtual reference column." It refers to the current row. For example, use [_THISROW].[ColumnName].
A Show_If column constraint is used when an input field should be shown or hidden depending on the values of one or more earlier field values in the form.
A Show_If constraint is a condition expression that determines whether or not an input for this column should be shown in a form. This is usually based on the values of other columns. For example, the condition expression [UserRating] = "5" will display this column if the value in the "UserRating" column is "5". The condition expression [Status] = "Green" will display this column if the value in the "Status" column is "Green".
The special column name "_THIS" is used to refer to the current column being constrained. For example, a Show_If condition of ISBLANK([_THIS]) can be used to show an input field only if the column itself is blank. The column will be hidden, once a data value has been entered and saved for the column.
Show_If conditions can also be defined on Page Header columns to conditionally show or hide entire pages.