# How Templates Work

Source: https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/how-it-works/

This page explains what a check template defines, how checks are created from it, what reaches those checks when the template changes, and what happens when a template is archived.

## What a Template Defines

The template form groups its settings the same way the check form does, minus the target:

| Group | Setting | What it does |
| --- | --- | --- |
| **Target** | **Rule type** | The rule every check from the template applies. It cannot be changed once the template is saved. |
|  | **Filter Clause** | An optional SQL `WHERE` expression that limits the records evaluated. It can use `each()` to create one check per value. See [Filter Permutations](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/filter-permutations/). |
| **Properties** | Rule properties | The values specific to the rule type, such as the minimum on a Min Value template. |
| **Pass Criteria** | **Coverage** | The percentage of evaluated records each check must satisfy. |
| **Template Options** | **Locked** | Whether the checks created from the template stay in sync with it. See [Locked and Unlocked Templates](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/how-it-works/#locked-and-unlocked-templates). |
| **Metadata** | **Description**, **Tags**, **Additional Metadata** | The plain-language description, the tags, and the key-value metadata the checks start with. |

A template has no table, file, or field. Those are chosen each time the template is applied, so the same template can run anywhere.

When [AgentQ](https://userguide.qualytics.io/agentq/getting-started/) is configured, the **Template Assistant** panel next to the form can propose a template from a plain-language description.

## Creating Checks from a Template

A template can create checks in three ways:

| Way | What it creates |
| --- | --- |
| **Add a Check** | One check, through the check form with the template already selected. You pick the datastore, table or file, and fields, then validate and save. See [Add a Check from a Template](https://userguide.qualytics.io/data-quality-checks/templates/how-tos/add-a-check/). |
| **Multiple Checks** | One check per target you list, each with its own table or file, fields, and filter clause. The checks are created as **Draft**, for review before they run. See [Add Multiple Checks from a Template](https://userguide.qualytics.io/data-quality-checks/templates/how-tos/add-multiple-checks/). |
| **`each()` in the filter** | One check per value, or per combination of values, in the template's filter. See [Filter Permutations](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/filter-permutations/). |

Every check created this way is an [Authored check](https://userguide.qualytics.io/data-quality-checks/checks/deep-dive/authored-checks/) linked to the template. When you add a single check, you can turn off **Associate with a Check template** before saving to create an independent copy instead, with no link to the template.

You can also go the other way and turn an existing check into a template. See [Create a Template from a Check](https://userguide.qualytics.io/data-quality-checks/templates/how-tos/create-from-a-check/).

## Locked and Unlocked Templates

The **Locked** option decides how the linked checks follow later edits to the template. It does not make the template read-only: a locked template can still be edited, and that is exactly how its checks get updated.

| When the template's... | Locked template | Unlocked template |
| --- | --- | --- |
| **Tags** change | Added tags are added to every linked check, and removed tags are removed from them. | The same: tags always follow the template. |
| **Rule properties**, **Coverage**, or **Filter Clause** change | Copied to every linked check. | Not copied. Each check keeps its own. |
| **Description** or **Additional Metadata** change | Copied to every linked check. | Not copied. |
| **`each()` values** change | Values added create checks, and values removed delete their checks. | Values added create checks. Values removed keep their checks. |

Two things always stay with the check, even on a locked template:

- **Its target and status.** The datastore, table or file, and fields remain the check's own, and so does its Active or Draft status.
- **Its permutation filter.** A check created by `each()` keeps the filter for its own value, such as `country_code = 'BRA'`, while the rest of the template's definition is copied to it.

On a check linked to a locked template, only the target can be changed. The other properties are managed from the template.

### When a Template Edit Is Refused

An edit that reaches the linked checks is applied to all of them or to none:

- If any linked check refuses the new definition, the template is not saved, and the message lists the checks that refused it and why.
- Users without the **Admin** role can only make such an edit when they can access every datastore that holds a linked check. Otherwise the edit stops with `Cannot update this template: it has linked checks in datastores you do not have access to`. An **Admin** can make the change.

## Archiving a Template

Archiving removes a template from the Library:

- A **Locked** template that still has linked checks cannot be archived. Unlock it first.
- Archiving an **Unlocked** template unlinks every check created from it. The checks keep running exactly as they are, but they no longer follow the template, and their **Template** badge disappears.

See [Archive a Template](https://userguide.qualytics.io/data-quality-checks/templates/how-tos/archive-a-template/).

## See Also

- **Filter Permutations**

  How `each()` in a template's filter creates one check per value, and how adding or removing values changes them.

  [Filter Permutations](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/filter-permutations/)
- **Template Overview**

  Every part of a template's Overview: Summary, Description, Definition, and Timeline, plus the page's tabs and actions.

  [Template Overview](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/template-view/overview/)
- **Template Checks**

  Every check created from the template, across datastores, and how to review the drafts it creates.

  [Template Checks](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/template-view/checks/)
- **Template Anomalies**

  The anomalies found by every check created from the template, and how to triage them from the template's page.

  [Template Anomalies](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/template-view/anomalies/)
- **Template Examples**

  Scenarios that show when a template pays off, and whether to lock it.

  [Template Examples](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/examples/)
- **Template Best Practices**

  How to name, lock, and maintain templates so their checks stay trustworthy.

  [Template Best Practices](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/best-practices/)
- **Template Permissions**

  Who can create, edit, apply, archive, and export templates.

  [Template Permissions](https://userguide.qualytics.io/data-quality-checks/templates/deep-dive/permissions/)

*Last updated: November 10, 2026.*
