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.
Element Name | RangeCheck |
---|---|
Parent Elements | ItemDef, WhereClauseDef |
Element XPath(s) | /ODM/Study/MetaDataVersion/WhereClauseDef/RangeCheck /ODM/Study/MetaDataVersion/ItemDef/RangeCheck |
Element Textual Value | None |
Attributes | Comparator, SoftHard, ItemOID |
Child Elements | ((CheckValue+ | (MethodSignature?, FormalExpression+)), ErrorMessage?) |
Usage/Business Rules |
Attribute | Schema Datatype or Enumeration | Usage | Definition | Business Rules |
---|---|---|---|---|
Comparator | (LT | LE | GT | GE | EQ | NE | IN | NOTIN) | Conditional | Comparison operator used to compare the item and value(s). | Required when at least a child element CheckValue is present. |
SoftHard | (Soft | Hard) | Conditional | Type of range check. Soft indicates that a warning occurs when the RangeCheck fails. Hard indicates that an error occurs when the RangeCheck fails. | Required when Comparator is present. |
ItemOID | oidref | Conditional | Identifies a variable to compare against. | Required when Comparator is present. Must match the ItemOID for an ItemRef sibling element within the ItemGroupDef. |
Range Checks using Comparator and CheckValue
When using Comparator and CheckValue, each range check represents a one-sided constraint. Multiple range checks can be used to specify more complex constraints (e.g., an upper and lower bound would require 2 range checks).
Each constraint is equivalent to:
itemValue comparator checkValue(s)
If an actual data value fails the constraint, it is either rejected (a hard constraint) or a warning is produced (a soft constraint).
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 an associated unit with a measurement variable is specified, the corresponding Item values must reflect the values using the associated units specified. Refer to ItemRef/@UnitsItemOID. Proper conversion of units must be done as part of the range check.
Example: RangeCheck: Value must be positive
<RangeCheck Comparator="GT"> <CheckValue>0</CheckValue> </RangeCheck>
Example: RangeCheck: Value IN (list)
<RangeCheck Comparator="IN"> <CheckValue>1</CheckValue> <CheckValue>3</CheckValue> <CheckValue>5</CheckValue> </RangeCheck>
Example: RangeCheck: Value between 18 to 65 inclusive
<RangeCheck Comparator="GE"> <CheckValue>18</CheckValue> </RangeCheck> <RangeCheck Comparator="LE"> <CheckValue>65</CheckValue> </RangeCheck>
Range Checks using FormalExpression
When using FormalExpression a range check can represent anything (e.g., one-sided or multisided checks). These type of checks must not provide CheckValue or Comparator 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
Example: Range Checks using FormalExpression
<RangeCheck> <FormalExpression Context="PL/SQL"> <Code>IT.DM.AGE between 18 and 65</Code> </FormalExpression> </RangeCheck>