# Using the visual filter builder

The visual filter builder is a point-and-click interface for creating BrewwQL filters without having to write any BrewwQL by hand. It appears wherever you see a BrewwQL filter box in Breww, such as on customer lists, sales lists, product lists and in the raw data explorer.

If you've used BrewwQL before, the visual builder produces exactly the same queries as writing them by hand - it's just a friendlier way to build them. You can switch between the visual builder and raw BrewwQL at any time. Here is an example:

<br />

![](https://storage.googleapis.com/breww-user-uploads/markdown-embedded/7a45fb2fd6788c7fdb86c5fa4010b898f853688d4f9dab1c01a57448d59d0e8e.png)

## Adding your first condition

When you open a list, click **+ Add condition** inside the filter box to start building a filter.

The field picker will open:

1. **Choose a field** - browse the list of fields, or type in the search box to filter the list. Fields are grouped by type (text, number, date, yes/no, choice, relationship).
2. **Drill into related data** - fields that link to another object (shown with an arrow) can be clicked to drill down. For example, from a customer list you can drill into **Customer group** and then pick fields on the customer group itself. You can keep drilling as deep as you like.
3. **Go back** - use the breadcrumb trail at the top of the field picker to jump back up a level.

   Once you select a field, the picker closes and you'll see an operator dropdown and a value input appropriate to the field's type.

## Operators and values

The operators you can pick from depend on the type of field you chose. For example:

* **Text fields** offer options like `equals`, `contains`, `starts with`, `ends with`, `has any value` and `has no value`.

* **Number fields** offer `equals`, `greater than`, `less than`, `between`, and more.

* **Date and date/time fields** offer `on`, `before`, `after`, `on or before`, `on or after`, `between`, `has any value` and `has no value`.

* **Yes/no fields** show a simple Yes / No toggle.

* **Choice fields** (like status, type, category) show a dropdown with the available options, or a tag picker when you use `is one of` / `is not one of`.

### Between

For numbers, dates and date/times, the `between` operator shows two value inputs side-by-side joined with an `and`. This is the easiest way to filter to a range (for example, orders placed between two dates).

### Has any value / Has no value

These operators are available for all fields and don't need a value. `has no value` matches rows where the field is empty (blank); `has any value` matches rows where it isn't.

## Working with dates

Date and date/time fields show a date picker alongside a dropdown of useful presets. Instead of typing a date by hand, you can pick from:

* Today

* Yesterday

* Tomorrow

* Start of this week

* Start of this month

* End of this month

* Start of this quarter

* Start of this year

* Custom (for typing a relative expression like `3 months ago` or `Monday next week`)

  The same natural-language expressions that work in raw BrewwQL also work in the custom value box - see [/docs/introduction-to-brewwql/](https://breww.com/docs/introduction-to-brewwql/) for the full list.

  For date/time fields, you can combine a date with a time keyword such as `end of day`, `start of day`, `noon` or `midnight` (for example, `Today end of day` or `Yesterday noon`).

## Combining conditions with AND / OR

Conditions are organised into **groups**. Each group can hold one or more conditions, and you can have multiple groups.

* **Within a group**, all the conditions are joined by the same connector. Click the AND/OR toggle in the group header to switch between them.

* **Between groups**, a shared AND/OR toggle sits on the divider line between each group. Clicking it changes how all your groups are connected.

  This two-level structure lets you build filters like "customers in London **or** with an average order value over £250, **and** who have ordered in the last 90 days" without ever having to think about brackets.

### Adding groups

Click **+ Add group** at the bottom of the filter box to create a new group. Each new group starts with a single empty condition ready for you to fill in.

### Removing conditions and groups

* The **✕** next to a condition removes just that condition.

* Removing the last condition in a group removes the whole group automatically.

## Applying your filters

When you're happy with your filter, click **Apply filters** at the bottom of the filter box. The list below will refresh to show the matching rows. Your filter stays active until you change or clear it.

## Switching to raw BrewwQL

Every filter you build in the visual builder can also be viewed and edited as raw BrewwQL. Click the **BrewwQL** link at the bottom of the filter box to switch to the text view, and click **Visual builder** to switch back.

If your raw BrewwQL uses features the visual builder can't represent (for example, `not` prefixes or deeply nested brackets), Breww will let you know and keep you in raw mode. You can still apply the filter - the visual builder is just a helper layer on top of BrewwQL.

## Saving your filter as a list

Once you've built a filter you want to reuse, you can save it as a list from the same screen. See [/docs/customer-and-lead-lists/](https://breww.com/docs/customer-and-lead-lists/) for more details on saved lists.

## Tips

* Start simple - add one condition, check the results, then add more.

* If you're not sure what a field contains, try filtering with `has any value` first to see which rows actually have data in it.

* You can always switch to raw BrewwQL to copy a filter, paste it into a ticket or share it with a teammate.
