-
Notifications
You must be signed in to change notification settings - Fork 4
Data Domain
Data domain describes a set of values by adding boundaries to an element data type. Here, boundaries are additional restrictions like character length, decimal place, allowed patterns, allowed values, and so on. For example, you define a data domain for email address, which is a string that follows certain patterns.
Data domain provides a layer of re-usability on technique level. It is assigned to data elements which provides a business level re-usability. For example, you may use the data domain 'email address' to create 2 data elements: 'private email' and 'work email'. The 2 email addresses have different labels, but share the same technique boundaries. The boundaries are used to validate the inputs when it is entered through UI and API.
In the modeling tool, go to the 'Data Domain' tab. The left list shows the 10 latest data domains in the system. You can run a fuzzy search which filters in names and descriptions. Click the '+' button on the top right, you can create a new data domain.
You must give a unique name to your data domain. Optionally, you may also give some description. You must choose an elementary data type. Currently, we provide following elementary data types: char, integer, boolean, decimal, string, binary, date, and timestamp. They can be mapped to the MySQL data types(boolean is mapped to tiny int).
Depends on the elementary data type you choose, different options are given.
Length is only valid for char and decimal types, and it means the maximum length. If decimal type is chosen, the decimal place is enabled, which means the number of fixed decimal places included in the given length. For example, given the length 23 and decimal place 2, it means a decimal with maximum 23 numbers and 2 of them are behind the decimal point.
The option is only valid for char and integer types. If char is chosen, you can set the option "Caption Only" which auto converts all lowercase letters into uppercase. If integer is chosen, you can set the option "Unsigned" which only allows positive integers.
The option is only valid for char and string types. You give a regular expression string to describe certain patterns. For example, the following regular expression represents all email addresses:
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
If you use jor-angular to develop UI, attributes with this kind of data domain will be validated using the provided regular expression.
Please check the syntax of regular expression in MDN Javascript Reference.
The option is only valid for char type. It is mainly used for referring the ID of master data. For example, data domain 'MATERIAL_ID' is maintained with entity 'material' and relation 'r_good'. Then, when a sales order item needs a material ID, the value of material ID is checked against relation 'r_good' in the entity 'material'.
If you use jor-angular to develop UI, attributes with this kind of data domain will be shown with search help button.
The option is valid for char and integer types. It is useful when you have a known list of codes, for example, country codes, currency codes, email types, and so on. Besides value array, you can also use value intervals. For example, postcodes may be valid only in a given interval, like from 200000 to 299999.
If you use jor-angular to develop UI, attributes with value array data domain will be shown as a dropdown list. Attributes with value interval will be checked if the input is inside the interval.
When you change a data domain, it also triggers changes of the underlying DB tables. However, some changes are incompatible, for example, a char type is changed to integer, or the length is shortened. The DB replies the incompatible errors, and you may have to manually correct them.
There are also some incompatible changes that DB cannot tell. For example, you remove an email type from the EMAIL_TYPE data domain, which is already used and stored in some transaction data. The next time you open the transaction data using a UI, you will see the incompatible value assigned to the email type field. Hopefully, the UI allows you switch to a valid value.