> For the complete documentation index, see [llms.txt](https://flapjax.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flapjax.gitbook.io/docs/your-data/stacks/filtering-and-segments.md).

# Stacks Filtering & Segments

### Segments

A segment is a saved filter that groups records by conditions you define. Records enter and leave a segment on their own as their data changes. You create and manage segments in **Settings > Segments**.

The sidebar carries a multi-select dropdown of the segments configured for this stack. Pick one or more to filter the records table down to matching entries. A badge next to "Filters" counts the active ones.

***

### Custom Filters

Click **Add custom filter** at the bottom of the sidebar for an ad-hoc filter you never save as a segment. A rule builder popover opens, where you:

1. **Choose a field** from the stack's attributes: text fields, numbers, dates, relationships and the rest.
2. **Select an operator** such as equals, contains, is greater than or starts with. Every operator, per data type, comes with examples in [Rules & Operators](/docs/core-concepts/rules-and-operators.md).
3. **Enter a value** to compare against.

Add as many rules as you need and combine them with **AND**, where every condition must match, or **OR**, where one is enough.

Close the popover when you finish and the records table narrows to matching entries.

***

### How Multiple Filters Combine

Inside one group, your rules combine by that group's **AND** or **OR** setting.

Stack more than one filter, say several selected segments, or a segment plus a custom filter, and each becomes its own group. **Flapjax joins the groups with AND**, so a record must match every active filter to appear. Grouping stays flat. Sibling groups sit side by side, with no sub-groups and no nested brackets.

| Active filters                                        | A record shows if…                     |
| ----------------------------------------------------- | -------------------------------------- |
| Segment "Open" (`status = new` OR `status = pending`) | it matches the Open segment            |
| Segment "Open" **and** custom filter (`amount > 100`) | it matches Open **AND** `amount > 100` |

***

### Saving a Custom Filter as a Segment

Built a custom filter you want to reuse? Click **Save as Segment** inside the rule builder popover. The segment creation form opens with your rules pre-filled and the stack already selected. Give it a name and emoji, then save.

***

### Updating a Segment's Rules

Segments created in Settings can be modified straight from the sidebar. Open the segment's popover, adjust the conditions, then click **Update**.

***

### Invalid Rules

A segment or custom filter can end up pointing at attributes that were removed or misconfigured. Its filter pill turns red with a warning icon. Open the popover, fix or remove the invalid rules, and filtering returns to normal.

***

### Clearing Filters

Click **Clear** next to the "Filters" heading to drop every active filter and segment. The records table returns to all data.

{% hint style="info" %}
**Tip:** Flapjax remembers your segment selections per stack when you leave and come back later in the same session.
{% endhint %}
