Cloud Software Group, Inc. EBX®
Documentation > User Guide > Data models > Implementing data models
Navigation mode Documentation > User Guide > Data models > Implementing data models

# Data validation controls on elements

After the initial creation of an element, you can set additional controls in order to complete its definition.

##### See also

- Properties of data model elements

## Simple content validation

Using the following static controls on a field, you can establish simple validation rules on its content. The controls available for a given field are dependent on its data type.

Fixed length | The exact number of characters required for this field.
Minimum length | The minimum number of characters allowed for this field.
Maximum length | The maximum number of characters allowed for this field.
Pattern | A regular expression pattern that the value of the field must match. It is not possible to simultaneously define a pattern for both a field and its data type.
Decimal places | The maximum number of decimal places allowed for this field.
Maximum number of digits | The maximum total number of digits allowed for this integer or decimal field.
Enumeration | Defines a list of predefined possible values for this field. If enumerations are defined in both a field and its type, then the enumeration of this field in associated datasets is replaced by the intersection of these two enumerations.
Greater than [constant] | Defines the minimum value allowed for this field.
Less than [constant] | Defines the maximum value allowed for this field.

See XML schema supported facets.

## Advanced content validation

Using the following dynamic and contextual controls on an element, you can establish advanced validation rules of its content. The controls available for a given element are dependent on the type of element and its data type, if it has one.

##### See also

- Dynamic constraints

Foreign key constraint |
Table | Defines the table referenced by the foreign key. A foreign key references a table in the same dataset by default. It can also reference a table in another dataset in the same dataspace, or a dataset in a different dataspace.
Mode | Location of the table referenced by the foreign key. 'Default': current data model. 'Other dataset': different dataset, in the same dataspace. 'Other dataspace': dataset in a different dataspace.
Referenced table | XPath expression describing the location of the table. For example, `/root/MyTable`.
Referenced dataset | Required if the table is located in another dataset. The unique name of the dataset containing the referenced table.
Referenced dataspace | Required if the table is located in another dataspace. The unique name of the dataspace containing the referenced table.
Label | Defines fields to provide the default and localized labels for records in the table. Allows as well to customize the display of the specified label in breadcrumb. Can also specify a Java class to set the label programmatically if 'XPath expression' is set to 'No'. This Java class must implement the `TableRefDisplay` interface of the Java API. Attention: Access rights defined on associated datasets are not applied when displaying record labels. Fields that are usually hidden due to access rights restrictions will be displayed in labels.
Filter | Defines a foreign key filter using an XPath expression. Can also specify a Java class that implements the `TableRefFilter` interface of the Java API.
Greater than [dynamic] | Defines a field to provide the minimum value allowed for this field.
Less than [dynamic] | Defines a field to provide the maximum value allowed for this field.
Fixed length [dynamic] | Defines a field to provide the exact number of characters required for this field.
Minimum length [dynamic] | Defines a field to provide the minimum number of characters allowed for this field.
Maximum length [dynamic] | Defines a field to provide the maximum number of characters allowed for this field.
Excluded values | Defines a list of values that are not allowed for this field.
Excluded segment | Defines an inclusive range of values that are not allowed for this field. Minimum excluded value: Lowest value not allowed for this field. Maximum excluded value: Highest value not allowed for this field.
Specific constraint (component) | Specifies one or more Java classes that implement the `Constraint` interface of the Java API. See Programmatic constraints for more information.
Specific enumeration (component) | Specifies a Java class to define an enumeration. The class must define an ordered list of values by implementing the `ConstraintEnumeration` interface of the Java API.
Enumeration filled by another node | Defines the possible values of this enumeration using a reference to another list or enumeration element.
Dataspace set configuration | Define the dataspaces that can be referenced by a field of the type Dataspace identifier (osd:dataspaceKey). If a configuration is not set, then only opened branches can be referenced by this field by default. Includes Specifies the dataspaces that can be referenced by this field. Pattern: Specifies a pattern that filters dataspaces. The pattern is checked against the name of the dataspaces. Type: Specifies the type of dataspaces that can be referenced by this field. If not defined, this restriction is applied to branches. Include descendants: Specifies if children or descendants of the dataspaces that match the specified pattern are included in the set. If not defined, this restriction is not applied to child dataspaces. If "None" then neither children nor descendants of the dataspaces that match the specified pattern are included. If "All descendants" then all descendants of the dataspaces that match the specified pattern are included. If "All descendant branches" then all descendant branches of the dataspaces that match the specified pattern are included. If "All descendant snapshots" then all descendant snapshots of the dataspaces that match the specified pattern are included. If "Child branches" then only direct branches of the dataspaces that match the specified pattern are included. If the current dataspace is a version, includes the branches that are the direct children of this version; if the current dataspace is a branch, includes the branches that are the direct children of the versions which are children of this branch. If "Child snapshots" then only direct snapshots of the dataspaces that match the specified pattern are included. If the current dataspace is a branch, includes the snapshots that are the direct children of this branch; if the current dataspace is a version, includes the versions that are the direct children of the branches which are children of this version. Excludes Specifies the dataspaces that cannot be referenced by this field. Excludes are ignored if no includes are defined. Pattern: Specifies a pattern that filters dataspaces. The pattern is checked against the name of the dataspaces. Type: Specifies the type of dataspaces that can be referenced by this field. If not defined, this restriction is applied to branches. Include descendants: Specifies if children or descendants of the dataspaces that match the specified pattern are included in the set. If not defined, this restriction is not applied to child dataspaces. If "None" then neither children nor descendants of the dataspaces that match the specified pattern are included. If "All descendants" then all descendants of the dataspaces that match the specified pattern are included. If "All descendant branches" then all descendant branches of the dataspaces that match the specified pattern are included. If "All descendant snapshots" then all descendant snapshots of the dataspaces that match the specified pattern are included. If "Child branches" then only direct branches of the dataspaces that match the specified pattern are included. If the current dataspace is a version, includes the branches that are the direct children of this version; if the current dataspace is a branch, includes the branches that are the direct children of the versions which are children of this branch. If "Child snapshots" then only direct snapshots of the dataspaces that match the specified pattern are included. If the current dataspace is a branch, includes the snapshots that are the direct children of this branch; if the current dataspace is a version, includes the versions that are the direct children of the branches which are children of this version. Dataspace filter Specifies a filter to accept or reject dataspaces in the context of a dataset or a record. This filter is only used in the dedicated input component that is associated to this field. That is, this filter is not used when validating this field. A specific constraint can be used to perform specific controls on this field. A filter is defined by a Java class that implements the `DataspaceSetFilter` interface of the Java API.
Dataset set configuration | Define the datasets that can be referenced by a field of the type Dataset identifier (osd:datasetName). Includes Specifies the datasets that can be referenced by this field. Pattern:Specifies a pattern that filters datasets. The pattern is checked against the name of the datasets. Include descendants: Specifies if children or descendants of the datasets that match the specified pattern are included in the set. Excludes Specifies the datasets that cannot be referenced by this field. Excludes are ignored if no includes are defined. Pattern: Specifies a pattern that filters datasets. The pattern is checked against the name of the datasets. Include descendants: Specifies if children or descendants of the datasets that match the specified pattern are included in the set. Filter Specifies a filter to accept or reject datasets in the context of a dataset or record. This filter is only used in the dedicated input component that is associated to this field. That is, this filter is not used when validating this field. A specific constraint can be used to perform specific controls on this field. A filter is defined by a Java class that implements the `DatasetSetFilter` interface of the Java API.

### Validation properties

Each constraint not using a specific Java class can define localized validation messages with a severity using the following properties:

Validation | Defines a localized validation message with a user-defined severity level.
Severity | Defines the severity level of the validation message. Possible values are 'Error', 'Warning', and 'Information'.
Error management policy | Specifies the behavior of the constraint when validation errors occur. It is possible to specify that the constraint must always remain valid after an operation (dataset update, record creation, update or deletion), or when a user submits a form. In this case, any input or operation that would violate the constraint will be rejected and the values will remain unchanged. If not specified, the constraint only blocks errors upon form submission by default, except for foreign key constraints in relational data models where errors are prevented for all operations by default. This option is only available upon static controls, exclude values, exclude segment and foreign key constraints. On foreign key constraints the error management policy does not concern filters. That is, a foreign key constraint is not blocking if a referenced record exists but does not satisfy a foreign key filter. In this case updates are not rejected and a validation error occurs. It is not possible to specify an error management policy on structural constraints that are defined in relational data models, when table history or replication is activated. That is, setting this property on fixed length, maximum length, maximum number of digits and decimal place constraints will raise an error at data model compilation because of the underlying RDBMS blocking constraints validation policy. This property is ineffective when importing archives. That is, all blocking constraints, excepted structural constraints, are always disabled when importing archives.
Message | Defines the message to display if the value of this field in a dataset does not comply with this constraint. If specifying a custom message, you may optionally provide localized variants.

##### Related concepts

- Properties of data model elements

User guide table of contents

Documentation > User Guide > Data models > Implementing data models