> For the complete documentation index, see [llms.txt](https://codifi-fdm.gitbook.io/codifi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codifi-fdm.gitbook.io/codifi-docs/mobile-app/mobile-project-settings/record-auto-numbering.md).

# Record Auto-Numbering

Codifi can automatically suggest the next Record name based on a prefix and a sequence — so a field crew typing the 47th shovel test of the day doesn't have to remember whether they're on `STP-46` or `STP-48`. The pattern is detected from your existing Records, and the next number is suggested when you create a new Record of the same kind.

This page covers the per-archetype Naming Policy, how scope works, and how to share a single sequence across multiple archetypes using a **Numbering Group**.

***

## How It Works

When you create a new Record, Codifi looks at existing Records that match the pattern `prefix + number` (e.g. `TS-1`, `Unit 42`, `Building3`), figures out the most-used prefix for the archetype you're creating, and suggests the next number.

| Existing Records             | Next suggestion                                                                   |
| ---------------------------- | --------------------------------------------------------------------------------- |
| `STP-1`, `STP-2`, `STP-3`    | `STP-4`                                                                           |
| `Unit 14`, `Unit 15`         | `Unit 16`                                                                         |
| `Feature-001`, `Feature-002` | `Feature-003` (preserves the leading-zero pattern)                                |
| *(no existing Records)*      | No suggestion — type whatever you want; the next Record will pick up your pattern |

You can always **override** the suggestion by typing your own name. Codifi never blocks the field; it just provides a smart default.

***

## Configuring Auto-Numbering

Auto-numbering is configured per-archetype in **Project Details → Settings**, under **Archetype Policies**. From there, tap any archetype to open its policy detail sheet.

> **Screenshot placeholder:** *The Archetype Policy Detail sheet showing the Auto-Numbering section with master toggle, scope toggle, and Numbering Group selector.*

### Master toggle

The first switch turns auto-numbering on or off for that archetype. If it's off, Codifi never suggests names for that archetype.

### Same Parent (scope)

The Same Parent toggle controls whether numbering restarts for each parent Record:

* **Off (Project-wide)** — numbers run across the entire Project. The 200th STP across 14 transects is `STP-200`.
* **On (per-parent)** — numbers reset for each parent. STP 1 of Transect 7 is `STP-1`; STP 1 of Transect 8 is also `STP-1`.

Both patterns are common in archaeological survey. Per-parent is more familiar to crews used to flagging tags; Project-wide is cleaner for QC and reporting because every Record has a globally-unique name.

***

## Numbering Groups

A **Numbering Group** lets multiple archetypes share a single sequence. This is useful when you want a unified count across different Record types — for example, a Project where *Site*, *Isolated Find*, and *Standing Building* all share a single "Resource" sequence.

### When to use a Numbering Group

* You want sequential IDs that don't repeat across archetypes (the next "Resource" is always one number higher than the previous, regardless of which archetype it is).
* You're matching an external schema that expects one master sequence (some agency catalogs, for instance).
* Multiple archetypes are conceptually peers and your team treats them as one population for counting.

### When NOT to use a Numbering Group

* The archetypes are clearly different concepts in your reporting (e.g. *Shovel Test* and *Datum* — keep these separate).
* Different archetypes have very different numbering conventions (e.g. one uses `STP-NNN` and another uses `R-NNN`).
* You want each archetype to have its own counter — the default behavior, no group needed.

### Setting up a Numbering Group

1. In the Archetype Policy Detail sheet, scroll to **Numbering Group**.
2. Tap **Numbering Group** and choose an existing group, or tap **+ New Group** to create one.
3. Give the group a name (e.g. "Resources," "All Cultural Features").
4. Open every other archetype that should share this sequence and assign the same group.

Once two or more archetypes share a group, they advance the same counter:

| Records created                  | Suggestions          |
| -------------------------------- | -------------------- |
| `Resource-1` (Site)              | next is `Resource-2` |
| `Resource-2` (Isolated Find)     | next is `Resource-3` |
| `Resource-3` (Standing Building) | next is `Resource-4` |

Same scope rules apply (Same Parent vs Project-wide) — but they apply to the **group**, not to a single archetype.

***

## How the Pattern is Detected

Codifi figures out the prefix automatically by looking at existing Records:

1. It matches names ending in a digit (`^(.*?)(\d+)$`) — so `STP-7`, `Unit 42`, `Building3` all qualify.
2. It groups Records by the prefix portion (`STP-`, `Unit` , `Building`).
3. For the archetype you're creating, it picks the **most-used prefix** and uses the **highest number + 1** as the suggestion.

This means you don't need to configure a prefix anywhere — Codifi picks it up from what your team is already doing. If you change the convention mid-Project (start typing `STP_7` instead of `STP-7`), the next suggestion will follow your new pattern after a couple of Records.

If no existing Records match the pattern, no suggestion is offered. The first Record of an archetype is always typed by hand; subsequent Records pick up the pattern.

***

## Tips

* **Set up archetype policies before fieldwork.** A field crew creating their first 50 Records with no auto-numbering is going to do it inconsistently. Five minutes in Project Settings prevents a week of cleanup.
* **Pick a Same-Parent scope deliberately.** Switching mid-Project gets confusing — Records created earlier follow the original rule.
* **Use Numbering Groups sparingly.** They're powerful but add a layer of indirection. The default (one sequence per archetype) is right for most Projects.
* **Leading zeros are preserved.** If your existing Records are `STP-001` through `STP-099`, the next suggestion is `STP-100` — Codifi notices the zero-padding and continues it. If you want a different padding length, type one Record by hand and the pattern updates.

***

## See Also

* [Media Configuration](/codifi-docs/mobile-app/mobile-project-settings/media-configuration.md) — sister system for naming photos/videos that uses the Record name as one of its inputs
* [Creating Records](/codifi-docs/mobile-app/creating-records/the-record-creation-screen.md) — where the auto-number suggestion appears on the Record creation screen
