Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Defining Event Listeners | Defining event expressions with one event template | Using name/value syntax to listen for events with particular content
Using name/value syntax to listen for events with particular content
Specification of every field in an event can get unwieldy when you are working with event types with a large number of fields and you are specifying values for only a few of them. In this case, you can use the name/value syntax in which you specify only the fields of interest. In the name/value syntax, it is as if you had specified a wildcard (*) for each field for which you do not specify a value. For example:
on MobileUser(hairColour="red", starsign="Capricorn",
    preferredGender=1) some_action();
The table below shows equivalent event expressions that demonstrate how to specify each syntax. The table uses these event types:
event A {
   integer a;
   string b;
event B {
   integer a;
event C {
 integer a;
   integer b;
   integer c;
Comparison Criterion
Positional Syntax
Equivalent Name/Value Syntax
on A(3,"string")
on A(=3,="string")
on A(a=3,b="string")
on A(b="string",a=3)
Relational comparisons
on B(>3)
on B(a>3)
on B([2:3])
on B(a in [2:3])
on C(*,4,*)
on C(*,*,*)
on C(b=4)
on C(a=*,b=4,c=*)
on C()
For details about the operators and expressions that you can specify in event templates, see Expressions.
It is possible to mix the two syntax styles as long as you specify all positional fields before named fields. For example:
*Correct event template: on D(3,>4,i in [2:4])
*Incorrect event template: on D(k=9,"error")

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.