Apama 10.15.0 | Developing Apama Applications | EPL Reference | Queries | Find statement | Having clause
 
Having clause
A find statement that specifies the every keyword can specify a having clause to restrict when procedural code is invoked.
Specify the having keyword followed by a Boolean projection expression. The Boolean projection expression refers to an aggregate calculation. Procedural code is executed only when the Boolean projection expression evaluates to true.
You can specify zero, one, or more having clauses. When you specify more than one having clause, it is equivalent to specifying the and operator. That is, each Boolean projection expression must evaluate to true for the procedural code to be executed.
A having clause can refer to an aggregate value by using the select coassignment name.
When you want to test for an aggregate condition but you do not want to use the aggregate value, you can specify a having clause without specifying a select clause.
Examples:
find every A as a
select avg(a.x) as aax
having aax > 10.0 {
print aax.toString();
}
 
find every A as a
having avg(a.x) > 10.0 {
print "Average value is greater than ten!";
}