Validation rules let you catch bad data the moment it’s typed — typos, out-of-range numbers, reversed depth intervals, missing required fields. Rules are defined per-column, evaluated as you edit, and surfaced inline in the spreadsheet.
Rules apply to both drillhole template fields and data table columns.
Severity: Error vs Warning
Every rule has a severity:
- Error (red) — the cell is highlighted red and the row cannot be saved until the issue is resolved.
- Warning (yellow) — the cell is highlighted yellow but the row can still be saved. A toast notification surfaces the issue.
Use Errors for hard constraints (negative depths, required fields, regex-bound sample IDs). Use Warnings for soft constraints (intervals crossing lithology boundaries, values outside an expected but not impossible range).
Where to set rules
In Templates, open a column card and click + Add Rule. You can add multiple rules per column — they’re all evaluated, and the worst severity wins.
Rule types
| Type | What it checks | Condition format | Example |
|---|---|---|---|
required | Field is not empty | (none) | mark name required so every drillhole has an ID |
range | Numeric min/max bounds | mathjs expression on the value | >= 0 && <= 100 for percentages |
pattern | Regex match | regular expression string | ^[A-Z]{2}\d{5}$ for sample IDs like GR00001 |
length | String length | mathjs expression on length | length >= 3 && length <= 12 |
custom | Any expression on the row | mathjs expression referencing column names | depth_to > depth_from |
depth-interval | Depth From < Depth To, no overlapping rows in the same drillhole | (automatic) | requires Depth From and Depth To markers — see Data Tables |
Range
Numeric bounds, expressed as a mathjs comparison on the column value. The value is referenced implicitly (you don’t type it). Examples:
>= 0 && <= 100— percentage column> 0— must be positive>= -90 && <= 0— dip in mining convention (negative = downhole)
Pattern
JavaScript-flavoured regex string. Common cases:
^DDH-\d{3,5}$— drillhole names likeDDH-001,DDH-12345^[A-Z]{2}\d{5}$— sample IDs likeGR00001^(N|S)\d+(\.\d+)?(E|W)\d+(\.\d+)?$— coordinate string format
Custom
A mathjs expression referencing other column names in the same row. The expression must evaluate to true for the value to be valid. Examples:
depth_to > depth_from— a row’s interval is the right way roundrecovery <= (depth_to - depth_from)— recovered length never exceeds drilled intervalau_g_t < 1000— sanity check on grade
Depth-interval
Automatic, no condition needed. Requires Depth From and Depth To markers on the table. Catches:
- Rows where Depth From ≥ Depth To
- Rows whose interval overlaps another row’s interval within the same drillhole
If your data tables have a Lithology source set (see Data Tables), depth-interval also raises a warning when an interval crosses a lithology contact.
How rules surface in the spreadsheet
- Cell highlighting. Cells failing an Error rule are shaded red; Warning cells are shaded yellow.
- Header counter. The spreadsheet header shows the current count, e.g.
3 errors · 2 warnings. Click the counter to jump to the first issue. - Save blocking. Errors prevent the row from saving. The Save button on the Edit Drillhole dialog is disabled while there are Errors. Inline cell edits in the spreadsheet are also rejected on Error.
- Toasts. Warnings display a non-blocking toast near the cell explaining the issue.
For step-by-step on resolving errors, see Fix Validation Errors.
Tips
- Start strict, loosen later. Easier to relax a rule than to clean up bad data after the fact.
- Use Warning for ambiguous cases. “Possibly wrong” deserves a warning, not a save-blocking error.
- Required fields cost nothing. Marking
name, depth markers, and key sample IDs as Required catches a huge fraction of real data-entry mistakes for free. - Lean on
customfor cross-column logic. The depth-from-less-than-depth-to check is the most common, but anything you can express in mathjs is fair game.