Unify and manage your data

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}]*).

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.
  • Logical Operator - Includes the AND/OR logical operators.
If you use a Data Validation Function on a nested attribute like an identifier, the expression must include the 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.

The following example uses UAN as the lookup code for the identifier type in the expression:
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]+'))
The following example uses Universal Account Number as the lookup value for the identifier type in the expression:
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]+'))