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

# Active Units

> Understand Active Units fields, service filters, statuses, grouping, sorting, pagination, and empty states.

The Active Units page shows entries from the SonoranCADFiveM on-duty unit cache. Server owners do not need to define every department.

![Sonoran Station Displays Active Units page showing LEO sample units](https://docs-assets.sonoransoftware.com/sha256/99/99ac44679ec877f836a75c503af888701da59517481e6dcbd5c53e63ab75710c.webp)

*The production LEO renderer using controlled sample data.*

![Sonoran Station Displays Active Units page showing Fire and EMS sample units](https://docs-assets.sonoransoftware.com/sha256/da/da85c9490b24e57867d8fdfe2b8e179a03dc73748a62af1e91bc423af8de3c6c.webp)

*The production Fire/EMS renderer using controlled sample data.*

## Duty and service

An entry must be present in `GetUnitCache()` and must not have offline status `100`. Player connection alone is not duty status.

Service comes from `unit.data.page`:

* Police (`0`) → `LEO`
* Fire (`1`) or EMS (`2`) → `FIRE_EMS`
* Dispatch (`3`) or unknown → `OTHER`

`OTHER` units are not shown on Active Units. The combined filter shows LEO and Fire/EMS, not `OTHER`.

## Displayed fields

Each row renders:

| Field | Fallback |
| - | - |
| Callsign | Cached unit number/callsign/group, then `UNIT` |
| Name | Cached name, then agency, then `On Duty` |
| Status | Normalized label or raw status/`UNKNOWN` |
| Assignment/location | `CALL <id>` when assigned; otherwise location, then postal |

Agency or subdivision may also appear as a group heading.

The normalized cache includes rank, district, group, coordinates, player association, panic, and update data, but version 1.0.0 does not render each of those as a row field. Panic callsigns receive a visual panic class.

Long callsigns, names, and locations are escaped and truncated with an ellipsis to protect the display layout. Missing values use the fallbacks above.

## Status values

| CAD status code | Display label |
| - | - |
| `0` | `UNAVAILABLE` |
| `1` | `BUSY` |
| `2` | `AVAILABLE` |
| `3` | `EN ROUTE` |
| `4` | `ON SCENE` |
| `100` | `OFFLINE` and excluded |

Unknown codes show the raw cached status or `UNKNOWN`.

Enable **Hide Unavailable Units** on a display to exclude status code `0`.

## Grouping

| Config value | Menu label | Behavior |
| - | - | - |
| `SERVICE` | By Service | Law Enforcement and Fire/EMS columns where applicable |
| `AGENCY` | By Agency | Cached agency; missing values use `UNASSIGNED AGENCY` |
| `SUBDIVISION` | By Subdivision | Cached subdivision; missing values use `NO SUBDIVISION` |
| `NONE` | Disabled | One `ON-DUTY UNITS` group |

Empty groups are not created. A display with no matching units shows:

```
NO ON-DUTY UNITS
The selected service has no active units
```

![Active Units grouped by agency](https://docs-assets.sonoransoftware.com/sha256/b1/b1d708e6dfd792207976de6e333a53edbf6f121f0690002efc4c6a8c42bbe556.webp)

*Agency grouping with natural callsign ordering and independent group pagination.*

![Active Units grouped by subdivision and sorted by status](https://docs-assets.sonoransoftware.com/sha256/55/555cb5751365a43ab18958e943e92950826fdaeb270a4a38bb86e54539ad241a.webp)

*Subdivision grouping with status sorting in a controlled renderer capture.*

## Sorting

| Config value | Field |
| - | - |
| `CALLSIGN` | Callsign |
| `STATUS` | Display status label |
| `AGENCY` | Agency |
| `SUBDIVISION` | Subdivision |

Sorting uses case-insensitive, numeric-aware browser ordering. Callsigns such as `1A-2` therefore sort naturally before `1A-10`.

![Active Units with grouping disabled and sorted by status](https://docs-assets.sonoransoftware.com/sha256/60/606f312f9f86f06edb3a432bb86cf6b8a11b0252484bea3f65a2523ca01881be.webp)

*A single group sorted by status.*

## Pagination and maximum rows

The default row budget is 12 and the allowed per-display range is 4–40.

When multiple groups are present, the budget is divided evenly across the number of groups with a minimum of one row per group. Each group automatically changes its list page every 10 seconds and shows `current/total` beside the group heading.

## Assignment and location

Dispatch call assignments are matched using the call cache's `idents` or `units` values. When a match is found:

* The unit row shows `CALL <call ID>`.
* The call card lists the unit's callsign.
* The map can add the call ID beneath the unit marker.

If no assignment exists, cached location is preferred over postal.

## Stale and missing data

An unchanged unit is marked stale internally after `Config.StaleAfterSeconds` (30 seconds by default). The Active Units table does not visually label individual stale rows; Live Map dims and outlines stale markers. If a cache call fails, the display shows the disconnected overlay.

Use diagnostics and `sonorancad viewcaches` to investigate a frozen or missing unit.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.