Understanding the Expression Attribute

The expression attribute explains the validations to be executed.

The expression attribute can contain more than one condition with one or more logical operators (AND/OR) applied. The syntax of the expression attribute is ({Condition Type}[AND/OR {Condition Type}]*).

The definition of the expression attribute in a data validation function object consists of the following details:
  • Condition Type - Indicates the condition to be applied on the attribute.
    • Syntax of Condition Type - ConditionName(attributeName, value1 [, value 2 ..]*)
    • Example of Condition Type - gte(attribute.Age.value, '60'). For more examples, refer to the table below.
  • Logical Operator - Includes the AND/OR logical operators.
Table 1. Supported Condition Types
Condition Type Description
gt Greater than check for number and date
gte Greater than or equals check for number and date
lte Less than check for number and date
equals Exact match condition check ignores the case
equalsCaseSensitive Exact match condition check considers the case
startsWith Starting with condition value check
in Value is a part of a list check
range Value within specified range check for number and date
regexp Regular expression check
exists Value exists check
missing Value is missing check
not Negating the condition check
contains Checks if the attribute value contains the given value
containsWordsStartingWith Checks that the attribute value contains words starting with the given value
lt Checks if the attribute value is lesser than the given static date