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, see topics DVF string functions, DVF number functions and DVF date functions.
- Syntax of Condition Type -
- Logical Operator - Includes the
AND/OR
logical operators.
inSameAttributeValue
function. For example:{
"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]+'))