New to expressions and formulas? Try Expressions: The Essentials.

The Required_If column constraint may be used to require a column value of a row be present before the row may be saved. If a required column value is blank, the row cannot be saved.

Required_If is commonly used to enforce conditional input requirements, such as:

  • Requiring a signature if the balance is above a threshold.
  • Requiring a card number if paying with credit or debit.
  • Requiring completion of prerequisites first.

The Required_If Expression

The Required_If column constraint is a Yes/No expression: if the expression evaluates as TRUE, the column value may not be blank; if FALSE, the column value may be blank.

As in all column constraint expressions, the Required_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.

Examples

([Subtotal] >= 20.0) : Require a signature if the subtotal is over $20.

IN([Payment Type], {"Credit Card", "Debit Card"}) : Require a card number if the chosen payment type is a credit or debit card. See also IN().

ISNOTBLANK([Address Line 2]) : Require address line 1 if line 2 has been provided already. No address is fine, but if you provide line 2, you gotta provide line 1! See also ISNOTBLANK().

AND(ISBLANK([Home]), ISBLANK([Mobile]), ISBLANK([Work])) : Require at least one of the three phone numbers. See also: AND(), ISBLANK().

TRUE : Require always. Equivalent to setting Require? to ON.

FALSE : Never require. Equivalent to setting Require? to OFF.

Setting Required_If

To set a column's Required_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 Data Validity section, which contains the Require? 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 Required_If expression. To remove the Required_If column constraint, click the X to the right of the expression box.

Scope of Required_If

The Required_If column constraint is applied any time a row update is attempted, such as when the user interacts with a form view or with a Quick Edit column (e.g., in a detail or table view), when app formulas and initial values are applied, and when actions attempt a data-change operation.

Did this answer your question?