> ## Documentation Index
> Fetch the complete documentation index at: https://filla.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Count limits

> Require a minimum or maximum number of linked records on a form field.

## What count limits do

Count limits let you enforce how many linked records a respondent can select. You can set a minimum (at least N records required), a maximum (no more than N), or both.

## When to use them

* **Minimum of 1**: effectively makes the linked field required at the record level (respondent must link at least one record)
* **Minimum of 2**: require multiple related records (e.g., at least two team members must be listed)
* **Maximum of 5**: cap the number of items (e.g., no more than 5 products per order)
* **Exactly 3**: set minimum and maximum to the same value

## Setting up count limits

Open the linked record field settings and scroll to the **Count limits** section.

| Setting               | Description                                                                                                     |
| --------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Minimum records**   | The fewest linked records allowed. Leave empty for no minimum.                                                  |
| **Maximum records**   | The most linked records allowed. Leave empty for no maximum.                                                    |
| **Min error message** | Custom error shown when too few records are linked. Use `{min}` as a placeholder for the count in your message. |
| **Max error message** | Custom error shown when the maximum is reached. Use `{max}` as a placeholder.                                   |

## Custom error messages

You can write your own error messages to make the constraint clear to respondents.

**Example min message:** `Please add at least {min} team member before continuing.`
**Example max message:** `You can add a maximum of {max} products per order.`

The `{min}` and `{max}` tokens are replaced with the actual numbers you set.

## How limits are enforced

Minimum limits are checked on submission. The form shows an error if too few records are selected. Maximum limits are enforced in the picker itself: once the maximum is reached, the respondent cannot select additional records. The picker controls gray out when the maximum is hit.

## Difference between "Required" and "Minimum records"

| Setting                 | What it means                                     |
| ----------------------- | ------------------------------------------------- |
| **Required** toggle     | At least one record must be linked (minimum of 1) |
| **Minimum records = 2** | At least 2 records must be linked                 |

For requiring exactly one linked record, using the standard **Required** toggle is simpler. Use **Minimum records** when you need a count higher than 1.

## Count limits and read-only fields

Count limits only apply while the respondent can change the selection. If the linked record field is read-only (static or conditional), the minimum and maximum are not enforced — the respondent cannot add or remove records anyway. The **Minimum records**, **Maximum records**, and their error messages are therefore disabled in the field settings panel while the field is read-only, with an inline note explaining why.

## Common questions

<AccordionGroup>
  <Accordion title="Can I set minimum and maximum to the same number?">
    Yes. Setting both to the same value (e.g., min = 3, max = 3) requires exactly that number of records.
  </Accordion>

  <Accordion title="What if the respondent has no records to select and a minimum is set?">
    If there are no records in the linked table (or none matching the filter), the respondent cannot meet the minimum requirement. Ensure the linked table has records available, or enable creating so respondents can add new ones.
  </Accordion>

  <Accordion title="Does the maximum affect what can be created through child forms?">
    Yes. If the maximum is 3 and the respondent has already linked 3 records, they cannot create more through the child form either. The create button is disabled once the maximum is reached.
  </Accordion>
</AccordionGroup>
