Edit a Logical Expression

When you add multiple filters to a segment, the filters are automatically joined together with a logical expression. This defines how the filters should work together to return data.

By default, the logical expression uses Boolean AND logic. For example, if you have a filter of contacts.prov_id = MT, and a filter of contacts.ma_state = Yes, the logical expression is contacts.prov_id = MT AND contacts.ma_state = Yes. This expression would result in the report returning only contacts that are from Montana and are in the Outreach state.

You can edit logical expressions to limit your data set by using different Boolean operators to connect your filters.

  • The AND operator retrieves data matching all of the filters.
  • The OR operator retrieves data matching any of the filters.
  • The NOT operator (represented by an exclamation point) excludes matching data.

When you add nodes to the expression, the nodes display in a tree structure, with filters displayed either under an AND node or an OR node. Filters under the same AND node are joined to each other using AND logic, and filters under the same OR node are joined to each other using OR logic.

NOT logic is achieved by negating a filter, which displays in the Filters section preceded by an exclamation point. For instance, if you negate the filter description contacts.prov_id = MT, the description appears as !contacts.prov_id = MT (equivalent to NOT contacts.prov_id = MT).

  1. From an open segment, add more than one filter to the Filters section.
    This image shows an open segment with two filters.


    This figure shows the window in which you can add multiple filters to a segment. You can define your segment by selecting the fields you wish to use from the Data Dictionary. You can either drag and drop or double-click on the field, and then specify the range of values that match your criteria. You can combine criteria using the logic operators provided.

    The filters you add are automatically joined with AND logic and display in an AND tree.

  2. To add a filter joined with OR logic to the logical expression:
    1. Click Add OR Node in the Actions section.
      The node is added to the logical expression.
    2. Click the filter that should be joined with OR logic and drag it to the new OR node.
  3. To negate a filter, select the filter and click Negate Filter in the Actions section.
  4. To view a text definition of the logical expression for the current filters, click View Text Definition.
    The Text Definition window opens.
  5. To display the filter description instead of the filter name, click Display Filter Descriptions.
    The filter description includes the field name, operator, and value. For example, a filter named Contacts in MT could be described as contacts.prov_id = MT.