Ranges and value sets in condition cells
- Last Updated: June 9, 2021
- 3 minute read
- Corticon
- Version 7.2
- Documentation
When using values in condition cells for attributes of any data type except
Boolean, the values do not need to be discreet. They can be in the form of a range. A value
range is typically expressed in the following format: x..y,
where x and y are the
starting and ending values for the range inclusive of the endpoints
if there is no other notation to indicate otherwise, as illustrated:
In this example, a maxCargoWeight value is
assigned to each Aircraft depending on the flightNumber value from the FlightPlan that Aircraft is associated with.
The value range 101..200 represents all values (integers
in this case) between 101 and 200, including the range endpoints 101 and
200. This is an inclusive range; the starting and
ending values are included in the range.
Corticon Studio also gives you the
option of defining value ranges where one or both of the endpoints are not inclusive,
meaning that they are not included in the range of values. This is
the same idea as the difference between greater than and greater than or equal to. The
following figure shows the same Rulesheet as in the previous figure, but with one
difference: the value range was changed from 201..300 to
(200..300]. The starting parenthesis ( indicates that the starting value for the range, 200, is exclusive; it is not included in
the range. The ending bracket ] indicates that the ending
value is inclusive. Because flightNumber is an integer
value, and therefore there are no fractional values allowed, so 201..300 and (200..300] are equivalent.
All of the possible combinations of parenthesis and bracket notation for value ranges and their meanings are:
If a value range has no enclosing parentheses or brackets, it is assumed to
be inclusive. It is therefore not necessary to use the [..]notation for a closed range in Corticon Studio.
However, should either end of a value range have a parenthesis or a bracket, then the other
end must also have a parenthesis or a bracket. For example, x..y) is not allowed, and is properly expressed as
[x..y).
Value ranges can also be used in the Filters section of the Rulesheet. See the Ranges and lists in conditions and filters for details about usage.