Using the Filter Operator


  The Filter operator accepts a single Input Stream and applies one or more predicates (EventFlow expressions that evaluate to TRUE or FALSE) to the arriving tuples. Each predicate maps to an output port. Filter predicates are evaluated in the order that they are listed, and if a predicate evaluates to TRUE, the tuple is emitted from the designated port. Evaluation halts after the first predicate that returns TRUE. You can define a Filter operator to either drop tuples not matching any of the predicates or send them to an output stream.

Use the Filter operator when you want to choose a different processing of data depending on some characteristic of the data. For example, if you wanted to create an alert if a stock trade transaction exceeded a specified number of shares, then use a predicate such as numShares > threshold to send those tuples to a stream to do the alert.

Properties: General Tab

Name: Use this required field to specify or change the name of this instance of this component. The name must be unique within the current EventFlow module. The name can contain alphanumeric characters, underscores, and escaped special characters. Special characters can be escaped as described in Identifier Naming Rules. The first character must be alphabetic or an underscore.

Enable Error Output Port: Select this checkbox to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally, enter text to briefly describe the purpose and function of the component. In the EventFlow Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Properties: Predicate Settings Tab

The Predicate Settings tab allows you to specify one or more predicate expressions as tests to apply to arriving tuples. A predicate returns TRUE or FALSE. If a tuple's data matches a TRUE condition in a predicate, it is moved onto a designated output port.

Each predicate is a test to be performed on the input tuple. Predicates are evaluated in the order in which they appear. If the predicate evaluates to TRUE, the tuple is sent to the corresponding output stream. If not, the next predicate is evaluated. A tuple is sent only to the first stream whose predicate is matched. If the Create Output Port for Non-matching Tuples option is checked and no other expressions return TRUE, the tuple is sent to an additional output port. If this option is not selected, no tuple is emitted.

Use the Up and Down arrows to reorder which predicate applies to which output port. Doing so preserves the arc connected to each output port, so that you do not need to remove and reconnect them. Thus, for example, if a Filter operator's port 2 is connected to an output stream named BigTradesOnly, you can move the predicate for port 2 to port 1 with the Up arrow, after which port 1 is now the port connected to stream BigTradesOnly.

Properties: Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.


Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.