Understanding the Expression Attribute
Learn about the expression attribute used in data validation functions.
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}]*)
.
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.
- Syntax of Condition Type -
- Logical Operator - Includes the
AND/OR
logical operators.
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 |
{
"name": "Identifiers Numbers Only Check",
"label": "Identifiers Numbers Only Check",
"expression": "inSameAttributeValue(not regexp(attributes.Identifiers.value.ID.value, '[0-9]+')
and equals(attributes.Identifiers.value.Type.value,'UAN'))",
"message": "Identifiers Numbers Only Check description",
"attribute": "configuration/entityTypes/Organization/attributes/Identifiers"
}
The inSameAttributeValue function works with lookup codes or with lookup values.
inSameAttributeValue(equals(attributes.Identifiers.value.Type.lookupCode, 'UAN') and exists(attributes.Identifiers.value.Type.lookupCode) and not regexp(attributes.Identifiers.value.ID.value, '[0-9]+'))
inSameAttributeValue(equals(attributes.Identifiers.value.Type.value, 'Universal Account Number') and exists(attributes.Identifiers.value.Type.value) and not regexp(attributes.Identifiers.value.ID.value, '[0-9]+'))