skip to main content
Corticon Studio: Rule Modeling Guide : Building the Vocabulary : Custom Data Types : Constraint Expressions

Try Corticon Now
Constraint Expressions
When you want to prompt Rulesheet and Ruletest designers to use a specific range values for an attribute, a constraint expression will validate entries when the associated Ruletest runs.
Constraint expressions are optional for non-enumerated Custom Data Types, but if none are used then the Custom Data Type probably isn't necessary because it reduces to a base attribute with a custom name.
All Constraint Expressions must be Boolean expressions, in other words they must return or resolve to a Boolean value of true or false. The supported syntax is the same as Filter expressions with the following rules and exceptions:
*Use the value to represent the Custom Data Type value.
*Logical connectors such as and and or are supported
*Parentheses may be used to form more complex expressions
*The expression may include references to Base and Extended Operators which are compatible with the Base Data Type chosen.
*No Collection operators may be referenced in the expression.
*There should be NO references to null. This is because null represents a lack of value and is not a real value. The Constraint Expression is intended to constrain the value space of the data type and expressions such as attribute expression <> null do not belong in it. An attribute that must not have a null value can be so designated by selecting Yes in its Mandatory property value.
The following are typical Constraint Expressions:
Constraint Expression
value > 5
Integer values greater than 5
value >= 10.2
Decimal values greater than or equal to 10.2
value in (1.1..9.9]
Decimal values between 1.1 (exclusive) and 9.9 (inclusive)
value in [‘1/1/2014 12:30:00 PM’..’1/2/2019 11:00:00 AM’)
DateTime values between ‘1/1/2014 12:30:00 PM’ (inclusive) and ‘1/2/2019 11:00:00 AM’ (exclusive)
value in [‘1:00:00 PM’..’2:00:00 PM’]
Time values between ‘1:00:00 PM’ (inclusive) and ‘2:00:00 PM’ (inclusive)
value.size >= 6 and (value.indexOf(1) > 0 or value.indexOf(2) > 0)
String values of minimum 6 characters in length that contain at least a 1 or 2
* Using non-enumerated Custom Data Types in Rulesheets and Ruletests