Using the Apama Studio Development Environment > Using Query Designer > Creating queries in Query Designer > Adding query inputs
Adding query inputs
In order to specify the event pattern that you want your query to find you must first define the event types that your query will process. You do this in the Inputs pane in the Design tab of Query Designer.
To add a query input:
1. In the Inputs toolbar, click the plus sign to display the Event Type Selection dialog.
2. Select the event type you want to add and click OK to display the New Query Input dialog.
3. In the New Query Input dialog, in the Key field, select one or two fields to be the query key.
A query key identifies one or more fields in the events being operated on. Each input definition for a given query must specify the same key. Apama uses the key to partition incoming events. A partition contains a set of events that all have the same key value. For example, you could partition Withdrawal events according to their account numbers. The query processes the set of events in a given partition independently of every other partition.
4. In the Filter field, optionally specify an expression that filters which events of this type you want the query to process.
For example, you might specify that you are interested in only the Withdrawal events whose amount field is greater than 10. In the filter expression, you can specify event fields of type boolean, decimal, float, integer, string or location.
If you want to refer to a parameter in a filter then you must add the parameter first. See Adding query parameters.
5. In the Within field, optionally specify a float expression or time literal that specifies the length of time that an event remains as a current event that the query operates on.
A query operates on only the set of current events. You must specify a value in either the Within field or in the Retain field or both.
6. In the Retain field, optionally specify an integer expression that specifies the length of time that an event remains as a current event that the query operates on.
You must specify a value in either the Within field or in the Retain field or both.
7. Click OK to add this input definition to your query.
Query Designer displays the new input definition in a row in the Inputs section and the event type you specified appears in the Palette.
8. Repeat these steps for each event type you want your query to process.
Apama recommends no more than four input definitions in a query.
You can add the same event type as a query input more than once. This makes sense only when each input definition specifies a different filter.
Copyright © 2013-2015 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.