> 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/segments.md).

# Segments

### How Segments Work

A segment is a set of rules that defines a group. "Country is Malta AND Created in the last 30 days" gives you a segment of recent Maltese contacts.

Segments come in two types:

* **People**, groups of contacts built on their attributes
* **Stacks**, groups of records from one stack built on their fields

#### How membership is calculated

A segment is a **saved rule group, run as a live query every time you use it**. Flapjax stores the rules, never the list of people or records that match them.

Membership comes fresh from your current data every time. Someone whose attributes change to match the rules shows up the next time the segment is read. Someone who stops matching drops out at that same moment. No stored membership exists, and no "entered segment" or "exited segment" events fire.

**Labels** work the other way. They keep a tracked membership record per person and log when the label went on. Segments do neither. They filter on demand.

***

### Viewing Segments

The segment list shows each segment with its:

* **Name**, with an emoji icon
* **Type**, People or Stacks
* **Updated by**, whoever last modified it

A pause icon marks any segment paused by a system issue, such as a deleted field the rules point at.

***

### Creating a Segment

Click **New segment** in the top-right corner, then fill in:

* **Name**, a descriptive name with an optional emoji
* **Relationship**, either **People** or **Stacks**
* The stack to filter, for a Stacks segment
* **Description**, an optional note on the segment's purpose

#### Building Rules

The rule builder appears once you pick the segment type. To add a condition:

1. Choose a **field** to filter on, such as Country, Email or a custom attribute.
2. Select an **operator**, such as equals, contains, is greater than or is after.
3. Enter a **value** to compare against.

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

Click **Save** when you finish.

***

### Editing a Segment

Click a segment in the list to reopen its form. You can change the name, the description and the rules. The segment type stays locked after creation.

***

### Deleting a Segment

Open the actions menu next to a segment and select **Delete**. Flapjax asks you to confirm.

{% hint style="info" %}
**Tip:** segments appear in the sidebar of the People and Stacks pages, so you can filter your list to a group in one click.
{% endhint %}

***

### Where segments are used

A segment is a reusable rule group, so it turns up in several places:

* **People filter.** Filter your People list down to a saved segment from the sidebar.
* **Stacks and records filter.** Filter a stack's records down to a saved segment from the sidebar.
* **Label rules.** A rule-based label can take a segment as a guard, so the rule only touches people already in that segment.
* **Automations.** An Enter Sequence or Enter Workflow step can target a segment, so only people who match its rules right now get enrolled.

Segments play no part in exports. Exports run on their own filters.
