Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Working with Streams and Stream Queries | Using dynamic expressions in stream queries | Behavior of static and dynamic expressions in stream queries
 
Behavior of static and dynamic expressions in stream queries
A static expression is an expression that refers to only static elements. Static elements are:
*Constants (defined with the constant keyword)
*Literal values, for example:
from a in all A() within 20.0 select sum(a.i);
*Primitive types that are local variables, for example:
integer width := 10;
from a in all A() retain width select sum(a.i);
The correlator can fully evaluate static expressions when it creates the stream query.
A dynamic expression is an expression that refers to one or more dynamic elements. In a query, the value of a dynamic expression can change throughout the lifetime of that query. Consequently, the correlator must re-evaluate each dynamic expression at appropriate points in the execution of the query.
Dynamic elements are:
*Any reference type
*Any monitor global variable
*Where the stream query is created by an action on an event, the members of that event
*Any action, method or plug-in call
The correlator fully evaluates an event template in a stream source template when the correlator creates the query. For example, consider the following two queries:
from a in all A(id=currentMatch) select a;
from a in all A() where id = currentMatch select a;
During execution, if currentMatch is a global variable, a change to the value of currentMatch affects the behavior of the second query, but it does not affect the behavior of the first query.

Copyright © 2013-2019 | 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.