Constraint

From PHENOM Portal Knowledgebase
Jump to navigation Jump to search

Constrains limit the possible values of a view attribute to which they are applied. The nature of the constraint is based on the primitive type employed by the view attribute.

Creating a Constraint

A new Constraint can be created by selecting the corresponding option in the 'Create>Logical' dropdown. Please note that, at this time, the editing of existing constraints is NOT supported in PHENOM - once created a constraint may only be viewed by selecting it in the NavTree.

A constraint can be one of three types: Regular Expression, Real Range, or Integer Range.

Much like the name suggests, a Regular Expression Constraint requires an expression which will limit the possible string values of a view field.

A Real Range Constraint has a lower and an upper bound, and can also specify the exclusivity of each.

An Integer Range Constraint limits the input between a lower and an upper bound, both of which are exclusive.

Applying Constraints to Platform Types

When creating or editing a Platform Type, you may associate a constraint with it. The primitive must be selected before a constraint can be applied - the constraints options will be filtered based on the primitive that has been selected.

String and Char primitives can have a Regular Expression constraint applied to them. Float and Double primitives can have a Real Range constraint applied to them. All other primitives are limited to Integer Range constraints. Enumerations cannot have a constraint applied to them at this time.

A new constraint can also be created while on the view attribute page by clicking the 'Create New Constraint' link on the right side of the constraint selection section. The creation form in the dialog will be limited to the constraint type that is applicable to the already selected primitive.