Body:
((CheckValue+ | FormalExpression+), MeasurementUnitRef?, ErrorMessage?) |
Attributes:
Comparator | (LT | LE | GT | GE | EQ | NE | IN | NOTIN) |
Comparison operator used to compare the item and value(s). | (optional) | ||
SoftHard | (Soft | Hard) | (optional) |
Contained in:
A RangeCheck defines a constraint on the value of the enclosing item. It represents an expression that evaluates to True when the ItemData value is valid or False when the ItemData value is invalid. The expression is specified using either Comparator and CheckValue or using FormalExpressions.
...
For the following comparison operators, one Check Value is required.
LT | Less than |
LE | Less than or equal to |
GT | Greater than |
GE | Greater than or equal to |
EQ | Equal to |
NE | Not equal to |
A set of Check Values is required for these comparators:
IN | One of listed values |
NOTIN | Not any of list values |
If a Measurement Unit is specified, the corresponding Item values must have interconvertible Measurement Units (either explicitly or by default). Proper conversion of units must be done as part of the Range Check. If a Measurement Unit is not specified, the corresponding Item values must not have Measurement Units (either explicitly or by default).
Examples:
Value must be positive |
| ||
Value must be between 18 and 65 inclusive |
| ||
Value must be one of (1, 5, 7) |
|
Range Checks using FormalExpression
When using FormalExpression a Range Check can represent anything, e.g., one sided or multi-sided checks. These type of checks must not provide CheckValue, Comparator or MeasurementUnitRef as they would all be expressed in the FormalExpression itself. The FormalExpression takes the value of the ItemData element and returns a boolean value which is the result of the expression. Multiple FormalExpressions can be provided if each has a different Context attribute, allowing the same expression to be represented in forms appropriate to multiple systems. Multiple different expressions, with different meanings, must be represented as separate RangeChecks
...