Home > Data Model Assistant
Define Advanced Constraints
In this section, we will present how to enrich the model with extended functionalities that XML Schema does not natively support.
Foreign key constraints
Previously, we have learned how to implement the primary keys for all table type elements in our schema. A reference to a table (foreign key) is defined using an advanced constraint.
As an example, we want to ensure that every pub_id entry in table Titles refers to a pub_id entry in table Publishers .
See also:
In the data structure tree, select the pub_id attribute under the Titles element, then the Advanced Constraints section:

At this step, we may specify:
-
External container : the reference of the instance containing the table. The default value ('No') refers to the current instance.
-
Referenced table (required): specifies the table.
-
Label : specifies the composition of the label to be displayed (default is the value of the primary key)
-
Display key : "true" or "false", specifies whether key is displayed as label prefix. Default is "true".

Dynamic constraints
EBX.Platform provides additional constraints that are not specified in XML Schema, i.e. dynamic constraints. A dynamic constraint is declared on an element, and references another one, semantically linking the two.
As an example, we want to ensure that, in the Royalties table, the lo_range value is always lower than the hi_range value.
We define a dynamic constraint on the lo_range element, referencing the hi_range element:

Note:
-
It is possible to define a specific localized error message for this constraint. If a specific error message is defined, it will be displayed in EBX.Manager for the end user.
-
The Exclude boundary property can be used to specify whether the lo_range value may be equal to the hi_range value.
Resource constraint
Sometimes, it may be useful to declare an external resource in the model. For instance, an image or HTML resource can enhance the look and feel of an instance screen in EBX.Manager.
In our sample model, we add to the Titles table a field called front_picture , which refers to an image, e.g. the front page of the book.
See also:
We input the properties of the resource constraint:

-
moduleName : the alias of the EBX.Platform module which contains the resource. If the module itself contains the resource, the alias must be preceded by "wbp" (stands for Web Business Process). Otherwise, the alias must be one of the values defined in the element <dependencies> in file 'module.xml'
-
resourceType : the resource type is one of the following values: "ext-images", "ext-jscripts", "ext-stylesheets", "ext-html"
-
relativePath : A local directory where the resource is located, just under the "resourceType" directory (here www/common/images ). Hence, for this example, the resource is located at www/common/images/frontpages/ where the www/ directory is at the same level as the WEB-INF/ directory.
Home > Data Model Assistant