Apama 10.15.0 | Developing Apama Applications | Developing Apama Applications in EPL | Working with Streams and Stream Queries | Defining stream queries | Adding window definitions to from and join clauses | Using multiple partition by expressions
 
Using multiple partition by expressions
To partition a window according to multiple criteria, you can insert multiple, comma-separated expressions. For example, you can refine a previous query to produce values for different volume bands as follows:
from t in all Tick()
   partition by t.symbol, t.volume.floor()/100 retain 1
   select rstream t;
In this example, the correlator applies retain 1 to each set of ticks that share both the same symbol and the same volume (to within 100). As a result, an item is output only when a replacement tick arrives for an existing symbol in an existing volume band.