Using the Apama Studio Development Environment > Using Query Designer > Creating queries in Query Designer > Adding query conditions > Adding query exclusions (without)
Adding query exclusions (without)
A query exclusion specifies that the presence of a particular event prevents a match. A query can specify zero, one or more exclusions. An exclusion can include a filter and/or a range to limit which instances of the identified event prevent a match.
To add an exclusion condition to a query:
1. In Query Designer, add the event inputs to the query and define the event pattern you want to find. See Adding query inputs and Adding query patterns.
2. In the Query Designer Conditions pane, click the down arrow next to the plus sign and select Exclusion (without).
3. In the New Query Exclusion dialog, in the Event Type field, select the event whose presence prevents a match. You can select only an event type that has been added as a query input. If the type you want to select is not listed then you must first add it as a query input.
For example, consider consecutive Withdrawal events that have different country field values. You want an alert when this occurs except when a TravelNotification event is received before the second Withdrawal event. In this case, select TravelNotification as the event type that prevents a match.
4. In the Name field, Query Designer displays a name that it automatically generates. This is an alias for the selected event and is unique across all aliases in the query. You have the option of using this alias in the next step.
5. Optionally, specify a Boolean expression that must evaluate to true for the presence of an event of the selected type to prevent a match.
For example, you might want a TravelNotification event to prevent a match only when its date field has the same value as the date field of the first Withdrawal event. If the event aliases w1, w2, and t1 are used, the following Boolean expression defines the exclusion filter: w1.date = t1.date. When the date fields of the first Withdrawal event and the TravelNotification event have the same value then the presence of the TravelNotification event between two consecutive Withdrawal events will prevent a match and an alert will not be sent. When the date fields of the first Withdrawal event and the TravelNotification event have different values then the presence of the TravelNotification event between two consecutive Withdrawal events will allow a match and an alert will be sent.
6. At the bottom of the dialog, indicate when the presence of the selected event prevents a match. If you accept During the whole pattern then select OK. You are done adding an exclusion.
7. If the presence of the selected event prevents a match only when it is received In between specific events, then select that option.
8. Select at least two events.
9. Click OK.
Query Designer displays the new exclusion in a row in the Conditions pane. To modify this exclusion, select it and then click the Edit icon. To remove this exclusion, select it and then click the Delete icon . Also, the new exclusion is immediately added to the source code as a without clause in the find statement. If you modify the exclusion in the Source tab this is reflected in the Conditions pane in the Design tab.
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.