Apama 10.15.0 | Developing Apama Applications | EPL Reference | Events and Event Listeners | Event templates | Field operators
 
Field operators
Field operators can appear within event templates to define a field value.
The on keyword creates an event listener that watches the series of events processed by the correlator for individual events or patterns of particular events. You define the sequence of interest in an event expression made up of one or more event templates. The first part of an event template defines the event type of the event the event listener is to match against, while the section in brackets describes further filtering criteria that must be satisfied by the contents of events of that type for there to be a match. Event template field operators define what values, or range of values, are acceptable for a successful event match.
The value that a field operator applies to can be the result of an expression. Therefore, it is possible to have >, <, >=, <= , and/or = present in both their roles, as expression operators and as field operators, within an event template. This is not a problem, since the latter are unary while the former are binary and the semantics are quite different.
The following table describes the field operators:
Operator
Description
[value1:value2]
Specifies a range of values that can match. The values themselves are included in the range to match against. For example:
on stockPrice(*, [0 : 10]) doSomething();
This example will invoke the doSomething() action if a stockPrice event is received where the price is between 0 and 10 inclusive. You can apply this range operator to decimal, float, integer and string types.
[value1:value2)
Specifies a range of values that can match. The first value itself is included in the range to match against while the second value is excluded from the range to match against. For example:
on stockPrice(*, [0 : 10)) doSomething();
This example will invoke the doSomething() action if a stockPrice event is received where the price is between 0 and 9 inclusive (assuming the field was of integer type). You can apply this range operator to decimal, float, integer and string types.
(value1:value2]
Specifies a range of values that can match. The first value is excluded from the range to match against while the second value is included. For example:
on stockPrice(*, (0 : 10]) doSomething();
This example invokes the doSomething() action if a stockPrice event is received where the price is between 1 and 10 inclusive (assuming the field was an integer). This operator can apply to decimal, float, integer and string types.
(value1:value2)
Specifies a range of values that can match. The values themselves are excluded from the range to match against. For example:
on stockPrice(*, (0 : 10)) doSomething();
This example will invoke the doSomething() action if a stockPrice event is received where the price is between 1 and 9 inclusive (assuming the field was of integer type).You can apply this range operator to decimal, float, integer and string types.
> value
All values greater than the value supplied will satisfy the condition for a match. You can apply this operator to decimal, float, integer, and string types. When used with a string, the operator assumes lexical ordering.
< value
All values less than the value supplied will satisfy the condition for a match. You can apply this operator to decimal, float, integer, and string types. When used with a string, the operator assumes lexical ordering.
>= value
All values greater than or equal to the value supplied will satisfy the condition for a match. You can apply this operator to decimal, float, integer, and string types. When used with a string, the operator assumes lexical ordering.
<= value
All values less than or equal to the value supplied will satisfy the condition for a match. You can apply this operator to decimal, float, integer, and string types. When used with a string, the operator assumes lexical ordering.
= value
All values equal to the value supplied will satisfy the condition for a match. You can apply this operator to decimal, float, integer, and string types. When used with a string, the operator assumes lexical ordering.
value
With one exception, only a value equivalent to the value supplied will satisfy the condition for a match. The exception is a location type field. A location value consists of a structure with four floats representing the coordinates of the corners of the rectangular space being represented. A listener that is watching for a particular value for a location field matches when it finds a location field that intersects with the location value specified in the listener's event expression. In the following example, the listener matches each A event whose loc field specifies a location that intersects with the square defined by (0.0, 0.0, 1.0, 1.0).
location l := location(0.0, 0.0, 1.0, 1.0);
on all A(loc = l) ...
*
Any value for this field satisfies the condition for a match.