Constraint at its most general is a synonym for a rule. Often a constraint is conceptualized as a rule that restricts the types of the data or types of parameters. Constraint is a restriction to the behaviour of a variable or a field.
Field constraints are usually transferred from database object, unless user declines synchronization while attaching object to data source. Field constraints can also be manually created. Several types of constraints exist:
Expression Constraint
Expression constraint is used for defining complex restrictions. Constraint is created in Expression Designer, therefore it is possible to create any kind of rule that must be satisfied in order to pass the validation. Because the rule is created with Expression Designer all data in the adapter is available for manipulation. System and environment functions are also available as well as many mathematical functions. There is virtually no limitation for creating desirable constraints.
Date Constraint
Date constraint is used for defining constraints for values of DateTime data type. It is possible to define minimum and maximum values for the input. The use of this constraint is specially recommended when trying to set bounds for a time period.
Numeric Constraint
Numeric constraint is used for defining constraints for values of Numeric data type. It is possible to define minimum and maximum values for the input. The use of this constraint is specially recommended when trying to set bounds for input numbers.
Nullable Constraint
Nullable constraint is used for ensuring that some value is entered in a field or a parameter. This type of constraint can be used on any type of data. It can also be used in a combination with all other kinds of constraints. Nullable constraint is often necessary to prevent data source exceptions like “Cannot insert NULL value into field StartDate”.
String Constraint
String constraint is used for defining constraints for values of String data type. It is possible to define minimum and maximum number of characters for the input. The use of this constraint is specially recommended when trying to limit the length of a string.
If a constraint is not met a warning is displayed to the user. If not specified otherwise a default message is displayed informing the user of the nature and the location of the failed constraint. However it is also possible to define custom text which will be presented to the user. Text is defined with property Text of each constraint. Text is created in Expression Designer. This gives the developer extensive possibilities when creating a description for the warning.