Apama 10.15.0 | Developing Apama Applications | EPL Reference | Events and Event Listeners | Event templates | Range expressions
 
Range expressions
A range expression is a part of a qualifier expression that describes a range of consecutive decimal, float, integer, or string values between a low boundary and a high boundary. The correlator tests an event's field value against this range to determine whether or not it falls within the specified range.
The values for the low boundary and the high boundary are the expression values. Both expression values must be of the same type and one of decimal, float, integer, or string. Both expression types must be of the same type as the event field being tested. Neither expression can contain any references to the event's fields.
If the low boundary value is greater than the high boundary value, the EPL runtime automatically reverses them.
Example
In the following EPL, the three on statements specify event listeners that are all listening for the same range of events:
event test
{   
string s;
   float f;
}
monitor RangeExample
{
   test t;
   action onload()
   {
      on test (f > 9.0 ) and test (f <= 10.0)
      {
      }
      on test ("", (9.0 : 10.0])
      {
      }
      on test (f in (9.0 : 10.0])
      {
      }
   }
}
Depending on which of the starting operators, [ or (, and ending operators, ] or ), you use, the boundary values will either be included in the range or excluded from it.
*If the starting operator is [, then the low boundary value is included and candidate values greater than or equal to the low boundary value are in the range.
*If the starting operator is (, then the low boundary value is excluded and candidate values larger than the low boundary value are in the range.
*If the ending operator is ], then the high boundary value is included and candidate values less than or equal to the high boundary value are in the range.
*If the ending operator is ), then the high boundary value is excluded and candidate values lower than the high boundary value are in the range.
Note that you can have one kind of starting operator at the beginning and the other kind at the end; they do not need to match.