# Field Count Check Examples

Source: https://userguide.qualytics.io/data-quality-checks/field-count/deep-dive/examples/

Three real-world scenarios that show how the Field Count check behaves in production: a stable extract that passes, a dropped column, and an added column. Field Count is a Shape-only rule, so every failure is reported as a single Shape Anomaly for the container.

**Tab: Stable Extract**

**The situation:** A partner receives a nightly `ORDERS` extract with an agreed layout of nine columns. The check exists to notice the moment that layout changes, in either direction.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Field Count |
| Table / File | `ORDERS` |
| Number of Fields | `9` |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Integrations team)* |
| Description | The ORDERS extract must hold exactly 9 fields. |
| Tags | `schema`, `drift` |
| Additional Metadata | `jira: DATA-9501` |
| Status | Active |

**Payload**

```json
{
    "description": "The ORDERS extract must hold exactly 9 fields.",
    "rule": "fieldCount",
    "fields": [],
    "container_id": 145,
    "properties": {"value": 9},
    "tags": ["schema", "drift"],
    "additional_metadata": {"jira": "DATA-9501"},
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}
```

**Sample Data**

| Container | Fields present | Count |
| --- | --- | --- |
| `ORDERS` | o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment | 9 |

**What gets flagged**

The container holds exactly nine fields, so the check passes and no anomaly is created. This is the baseline the next two scenarios drift away from.

**Flowchart**

```mermaid
graph TD
    A["Read the container's shape"] --> B["Count the fields: 9"]
    B --> C{"Does 9 equal the<br/>expected 9?"}
    C -->|Yes| D["Check passes"]
    C -->|No| E["Report a Shape Anomaly"]
```

**Equivalent SQL**

```sql
-- The equivalent question, asked of the catalog rather than the data.
SELECT count(*) AS field_count
FROM information_schema.columns
WHERE table_name = 'ORDERS';
-- The check passes when field_count = 9.
```

**Tab: A Column Was Dropped**

**The situation:** An upstream release removed `o_comment` from the extract without telling the consumers. The row data still looks fine, so no value-level check fires: only the shape changed.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Field Count |
| Table / File | `ORDERS` |
| Number of Fields | `9` |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Integrations team)* |
| Description | The ORDERS extract must hold exactly 9 fields. |
| Tags | `schema`, `drift` |
| Additional Metadata | `jira: DATA-9501` |
| Status | Active |

**Payload**

```json
{
    "description": "The ORDERS extract must hold exactly 9 fields.",
    "rule": "fieldCount",
    "fields": [],
    "container_id": 145,
    "properties": {"value": 9},
    "tags": ["schema", "drift"],
    "additional_metadata": {"jira": "DATA-9501"},
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}
```

**Sample Data**

| Container | Fields present | Count |
| --- | --- | --- |
| `ORDERS` | o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority | 8 |

**What gets flagged**

The scan finds eight fields where nine are expected. The check reports a single Shape Anomaly for the container; the direction of the difference tells you a column was dropped rather than added.

> **Example: Shape Anomaly**
>
> ORDERS has 8 fields, not the expected 9

**Flowchart**

```mermaid
graph TD
    A["Read the container's shape"] --> B["Count the fields: 8"]
    B --> C{"Does 8 equal the<br/>expected 9?"}
    C -->|Yes| D["Check passes"]
    C -->|No| E["Report a Shape Anomaly<br/>for the container"]
```

**Equivalent SQL**

```sql
-- Confirming the drop against the catalog.
SELECT count(*) AS field_count
FROM information_schema.columns
WHERE table_name = 'ORDERS';
-- Returns 8; the check expected 9.
```

**Tab: A Column Was Added**

**The situation:** A new `o_channel` column was added upstream. Nothing broke immediately, but the downstream loader maps columns by position and will silently shift every value on the next run.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Field Count |
| Table / File | `ORDERS` |
| Number of Fields | `9` |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Integrations team)* |
| Description | The ORDERS extract must hold exactly 9 fields. |
| Tags | `schema`, `drift` |
| Additional Metadata | `jira: DATA-9501` |
| Status | Active |

**Payload**

```json
{
    "description": "The ORDERS extract must hold exactly 9 fields.",
    "rule": "fieldCount",
    "fields": [],
    "container_id": 145,
    "properties": {"value": 9},
    "tags": ["schema", "drift"],
    "additional_metadata": {"jira": "DATA-9501"},
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}
```

**Sample Data**

| Container | Fields present | Count |
| --- | --- | --- |
| `ORDERS` | o_orderkey, o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment, o_channel | 10 |

**What gets flagged**

The scan finds ten fields where nine are expected, so the check reports a Shape Anomaly. If the addition is legitimate, the fix is to update the check's **Number of Fields** as part of accepting the new layout.

> **Example: Shape Anomaly**
>
> ORDERS has 10 fields, not the expected 9

**Flowchart**

```mermaid
graph TD
    A["Read the container's shape"] --> B["Count the fields: 10"]
    B --> C{"Does 10 equal the<br/>expected 9?"}
    C -->|Yes| D["Check passes"]
    C -->|No| E["Report a Shape Anomaly<br/>for the container"]
```

**Equivalent SQL**

```sql
-- Confirming the addition against the catalog.
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'ORDERS'
ORDER BY ordinal_position;
-- Returns 10 rows; the check expected 9.
```

## See Also

- **How It Works**

  The complete reference: definition, container scope, the expected count, how the shape is evaluated, and why coverage and filters do not apply.

  [How It Works](https://userguide.qualytics.io/data-quality-checks/field-count/deep-dive/how-it-works/)
- **Anomaly Reporting**

  What the Shape Anomaly reports, how to read it, and why per-row reporting does not apply.

  [Anomaly Reporting](https://userguide.qualytics.io/data-quality-checks/field-count/deep-dive/anomaly-reporting/)
- **Best Practices**

  Guidelines for pairing with Expected Schema, keeping the count current, and avoiding false alarms.

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

  The team permission each action needs: view, create, edit, archive, restore, and delete.

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

*Last updated: September 22, 2026.*
