Skip To Content

Use choices

Choices are configurable elements of GeoEvent Services that route GeoEvents, or event records, to one of many destinations based on specified conditions. Choices are configurable elements that use conditional statements applied to the event records in order, much like an if-else statement in programming languages. In addition to the conditional statements, an optional final route can be defined for events that do not pass the list of specified conditional statements.

Working with choices

As mentioned above, a choice specifies a list of routes a GeoEvent could take. Each route is evaluated by a when clause that defines the conditional statement an event must meet to pass through. If an event passes the condition defined by the when clause, it follows that route. If an event does not pass the condition defined by the when clause, it passes to the next when clause if one exists. The when clauses in a choice are processed in a serial order, all configurable in the choice element.

If an event record does not meet any of the conditions specified in the when clauses, it can optionally be passed to an otherwise route. If an otherwise route is enabled, the event is passed to that route, and there is no condition that must be met. If an otherwise route is not enabled, the event record is dropped and is not passed to any route.


An event record that meets the condition in a given when clause will not be considered for any subsequent when or otherwise routes.

Example use cases

Below are some use cases for when a choice element could be used.

Transportation vehicle monitoring

In this example, assume a given data feed provides event data for different types of transportation vehicles, and each must be processed differently. The data contains a field (VehicleType) that contains information about three types of transportation vehicles (Airplane, Train, and Automobile). Using a choice element, each event record can be routed to a separate processing workflow based on the vehicle type. If the data feed sends an event record that is not one of the three vehicle types, such as Truck, the event is dropped.

Example conditional statements in a choice

Consider the following conditional statements applicable to this example:

  • If Vehicle Type equals Airplane, then process the event record as an airplane.
  • If Vehicle Type equals Train, then process the event record as a train.
  • If Vehicle Type equals Automobile, then process the event record as an automobile.
  • If Vehicle Type equals Truck, then drop the event record.

Example conditional statements

Snowplow speed monitoring

In this example, assume a data feed provides event data for a fleet of snowplow vehicles and their current speed. During plowing operations, the normal vehicle speed is between 25 and 35 miles per hour. Any deviation below this range indicates the snowplow is operating inefficiently and any deviation above this range may damage the snowplow.

Example conditional statements in a choice

Consider the following conditional statements that apply when the snowplow is plowing:

  • If the speed is less than or equal to 24 miles per hour, then the status of the snowplow will be Low Speed.
  • If the speed is greater than or equal to 36 miles per hour, then the status of the snowplow will be High Speed.
  • Otherwise, the snowplow status will be Normal Speed.

Example conditional statements

Considerations when working with choices

There are many considerations when working with choices, including the following:

  • Each choice requires at least one conditional statement.
  • Defining an otherwise clause is optional and disabled by default.
  • Each choice element can have one or more parent elements and those parent elements must be either an input, filter, or processor.
  • Each when clause can have only one target element, meaning there can only be one outgoing route from each conditional statement including the otherwise.
  • If a use case requires the target of one when clause to be routed to more than one element (such as routing to two separate outputs), use a No Operation Processor as the target of the when clause, then branch from there.
  • The target of a choice element must be either empty (no target), a processor, a filter, or an output.
  • A choice element cannot route to another choice element, meaning two choice elements cannot be placed in a row in a GeoEvent Service:
    • The input to a choice cannot be the output of another choice.
    • The target of a choice cannot be another choice.
  • If a use case requires the target of one choice element be routed to a second choice element, do one of the following:
    • Use a No Operation Processor in between the two choice elements.
    • Include the when clauses from the second choice into the first choice.

Add a choice element to a GeoEvent Service

To add and configure a choice element in a GeoEvent Service, complete the following steps:

  1. In the service designer of GeoEvent Manager, drag a Choice element from the New Elements list onto the canvas.

    Choice window

  2. Enter a Name for the new choice element.

    In a choice, one or more conditional statements can be applied to the event data in the specified order. Each conditional statement has a unique name that identifies it as well as a number (starting with 1) that indicates the order in which the conditional statements will evaluate the event data.

  3. Click Add to add a conditional statement.

    Add a conditional statement.

  4. In the Choice Properties window, follow the steps below to add a when clause.

    Choice Properties window

    1. Enter a Name for the conditional statement.
    2. Click Add Expression Add expression button to add and configure a when clause.
    3. Click Add Expression Add expression button again to add and configure additional when clauses.
    4. Click OK to save the conditional statement.
  5. Repeat steps 3 and 4 above to add more conditional statements, as necessary.
  6. Optionally, check the Otherwise check box to define an otherwise route.

    Otherwise route option


    Checking the Otherwise check box enables an otherwise route. All events that do not meet the criteria defined by the when clauses will be passed to the otherwise route. If the Otherwise check box is not checked, any event records not meeting the defined when clauses will be dropped.

  7. Click OK to save and add the choice element to the service designer.
  8. Connect the new choice element to your other elements in the GeoEvent Service.

Edit a choice

The Choice window provides options to review, edit, delete, and reorder configured conditional statements.

  • Hover over Info button to view the when clauses associated with a conditional statement.
  • Use the Edit button Edit button to open and edit a conditional statement's when clauses.
  • Use the Delete button Delete button to delete a conditional statement.
  • Use the Reorder button Reorder button to change the order of how the conditional statements evaluate the event data.

Using filters in when clauses

In a when clause, different types of filters can be used to evaluate the event data. For details on the different types of filtering options, see the resources below: