Validations
A validation is a piece of dynamic logic that takes a value as its input and returns a Boolean as a result. Within the dynamic logic, the input value is referenced as "value". Oracle Health Insurance Product Definition can use dynamic logic validations in the configuration of fields. Field is a signature assigned to a piece of dynamic logic. A signature specifies the expected in- and output for specific piece of dynamic logic. The following sections each elaborate on one of these signatures.
Field
A field can have zero or one dynamic logic validation defined. The following signature applies:
In / Out | Name | Type | Description |
---|---|---|---|
In |
value |
Same as the field data type |
The value of the field |
Out |
n/a |
Boolean |
True when the value is valid |
The output will be interpreted by OHI according to Groovy truth logic, meaning that in case a null value is returned - this will be interpreted as false.
This signature does not specify a default as-of date. The execution moment depends on the field type; for free fields the dynamic logic validation is executed when entering a value for the free field; for flex fields the dynamic logic validation is executed when entering a flex code. Consider some simple examples of field validations:
The dynamic logic to accept only values in uppercase:
value == value.toUpperCase()
To accept only values is in lowercase:
value == value.toLowerCase()
To accept only values that can be parsed as an integer:
value.isInteger()
To accept only values that have no more than 40 characters:
maxLength = 40 value.length() <= maxLength
To accept only values between two numerical values:
min = 18 max = 65 value >= min && value <= max
To accept only values in a specified list:
allowedValues = [ "A", "B", "C" ] allowedValues.contains(value)