Skip to content

Max Length Best Practices

Guidelines for getting reliable signal from Max Length checks while keeping the noise (and the maintenance) low.

Set the limit from the consumer, not from the current data

The useful ceiling is usually the one imposed by a downstream schema, an export format, or a printed layout. Anchoring the limit there makes the anomaly actionable: it tells you the value will break something specific.

Mind the whitespace

Padding from fixed-width extracts and trailing spaces from form inputs both count toward the length. When they are not meaningful, trim the value upstream or with a Computed Field, so the check measures the data rather than its formatting.

Pair with Min Length when both ends matter

Max Length guards one side of the length. When the value also has a meaningful limit on the other side, add a Min Length check on the same field so the pair states the full rule.

Use Matches Pattern when the shape matters, not just the size

Length is a blunt instrument: a 10-character value can still be nonsense. When the field has a known format, Matches Pattern expresses the real rule and usually makes a length check redundant.

Pair with Not Null when the value is mandatory

NULL values pass. The rule asserts that present values satisfy it; it does not require the field to be populated. When the field must also have a value, add a Not Null check on the same field.

Keep coverage at 100% unless a known backlog exists

At 100% coverage every failing row is reported as a Record Anomaly, which tells you exactly which values break the rule. Below 100% the check reports a single Shape Anomaly only when the failing fraction crosses the tolerance, and no per-row detail is produced. Lower coverage only while a known set of legacy rows is being cleaned up.

Scope with a filter instead of loosening coverage

When the rule only applies to part of the table (one product line, one tier, one period), express that with a filter clause rather than by lowering coverage. The filter removes the out-of-scope rows from evaluation entirely, and the expression is echoed in every anomaly message.

Route the anomalies to the right people

An out-of-bounds number usually comes from an application that failed to validate its input, or from a unit mismatch upstream. Set an Anomaly Assignee from the team that owns that producer, and tag the check so related checks are easy to find.

See Also