skip to main content
Corticon Studio: Rule Modeling Guide : Rule writing techniques and logical equivalents : Qualifying rules with ranges and lists : Using ranges and value sets in condition cells
 

Try Corticon Now
Using ranges and value sets in condition cells
When using values in Condition Cells for attributes of any data type except Boolean, the values do not need to be discreet – they may 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. This is illustrated in the following figure:
Figure 71. Rulesheet Using Value Ranges in the Column Cells of a Condition Row
In this example, we are assigning a maxCargoWeight value to each Aircraft depending on the flightNumber value from the FlightPlan that the 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 in that 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 exclusive, 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, Rulesheet Using Open-Ended Value Ranges in Condition Cells, shows the same Rulesheet shown in the previous figure, but with one difference: we have changed the value range 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. Since flightNumber is an Integer value and there are therefore no fractional values allowed, 201..300 and (200..300] are equivalent.
Figure 72. Rulesheet Using Open-Ended Value Ranges in Condition Cells
Listed below are all of the possible combinations of parenthesis and bracket notation for value ranges and their meanings:
Figure 73. Rulesheet Using Open-Ended Value Ranges in Condition Cells
As illustrated in columns 2-3 of Rulesheet Using Value Ranges in the Column Cells of a Condition Row and column 2 of Rulesheet Using Open-Ended Value Ranges in Condition Cells, 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; in fact, if you try to create a value range with [..] in Corticon Studio, the square brackets will be automatically removed. 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 Using ranges and lists in conditions and filters for details on usage.
* Boolean condition Vs. values set
* Numeric value ranges in conditions
* String value ranges in condition cells
* Using value sets in condition cells
* Using value lists in condition cells
* Using variables as condition cell values
* DateTime, date, and time value ranges in condition cells
* Inclusive and exclusive ranges
* Overlapping value ranges
* Alternatives to value ranges