Skip to main content

How to group filters in the Query Builder for complex reports.

Explains how to group filters with parentheses to control AND/OR logic.

You will need the Reporting permission to perform this action. Your campus access and the campus selector apply outside your filters and parentheses, so an "or" cannot bring back a row they leave out.

In the One Church Software Query Builder, parentheses group conditions together and control the order in which your query's logic is evaluated, the same way they work in a math equation, where multiplication and division are handled before addition and subtraction.

In the same way, AND is evaluated before OR. Parentheses let you change that order so the query evaluates the way you intend.


Why use parentheses?

Parentheses help you build queries with several AND and OR conditions by making it clear which parts of the logic should be evaluated together.

Without parentheses, the system evaluates conditions in the order they're listed, which can lead to incorrect or unexpected results.


Example without parentheses

A query with AND and OR conditions and no parentheses

Without parentheses, the system may interpret this as:

Is Archived? = no (record type = "Active" AND Age < 18)

This would include all active profiles, or only visitors who are under 18, which may not be what you intended.


Example with parentheses

The same query with the OR conditions grouped in parentheses

This means: only include people who are either active profiles or visitors, but only if they are under 18.


How to add parentheses

1. While building your query, select Add parentheses (the ( ) button below the query rows).

The Add parentheses button below the query rows

2. An empty set of parentheses appears with a highlighted area. Choose the filters you want to group together from the Filters pane on the left, and they'll be placed inside the parentheses.

Filters placed inside a set of parentheses

To control how each condition combines with the others, select the and / or connector to the left of a condition to switch between them.

Tip: A few habits that make grouping easier:

• Preview your results to make sure the logic works the way you expect.

• Sketch your logic out before building it in the Query Builder.

• Use AND within a group for tighter matching, and OR to widen your results.

Other Helpful Articles

Did this answer your question?