Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Constraints
Constraint Composition:
Constraints are composed using member and local variables in expressions separated by operands such as:
• | / |
• | * |
• | % |
• | + |
• | - |
• | > |
• | >= |
• | < |
• | <= |
• | OR |
• | AND |
• | ( |
• | ) |
The following is an example Conditional expression that returns a Boolean True/False:
( (x%2) > 1) AND (y >= 10) )
Variables can be scoped by either '.' or '->'
c.Name : c.Names[0] of an array as c.Names[0].Surname= "Smith"
There are two types of operators you can use on constraints:
• | Logical operators AND and OR can be used to combine constraints |
• | Equivalence operators '=' and '!=' can be used to define the conditions of a constraint |
All constraints are subject to an AND operation unless otherwise specified; you can use the OR operation on them instead, for example:
Location=0 OR
Location=1 AND
Departing.Name!=Central
(a AND b)
(a.b AND ( b.a OR c.a))
Below are some examples of using the equivalence operators:
m_value!="true"
m_value <> 0
m_value[10]="john"
m_value[0][1]=2
Notes
• | Quotes around strings are optional; the comparison for strings is always case-sensitive in determining the truth of a constraint |
Learn more
Learning Center topics
• | (Alt+F1) | Execution Analysis | Testpoints | About Constraints |
• | (Alt+F1) | Execution Analysis | Testpoints | About Statements |