docs(validations): document how each rule treats a special missing value #8

Open
hermes wants to merge 4 commits from docs/special-missing-rule-behaviour into main
+28 -2
View File
@@ -23,12 +23,12 @@ It is possible to configure a number of other rules by updating the MPE_VALIDATI
## Configurable Checks
Check back frequently as we keep growing this list of checks.
Check back frequently as we keep growing this list of checks. For how each rule treats a special missing value (`.A`-`.Z`, `._`), see [Special Missing Values](#special-missing-values).
|Rule Type|Example Value |Description|
|---|---|---|
|CASE|UPCASE|Will enforce the case of cell values. Valid values: UPCASE, LOWCASE, PROPCASE|
|NOTNULL|(defaultval)|Will prevent submission if null values are present. Optional - provide a default value.|
|NOTNULL|(defaultval)|Will prevent submission if null values are present - a special missing counts as null. Optional - provide a default value.|
|MINVAL|1|Defines a minimum value for a numeric cell|
|MAXVAL|1000000|Defines a maximum value for a numeric cell|
|READONLY|(defaultval) |Renders the column read-only in the editor. The defaultval is used when rows are added. |
@@ -45,6 +45,32 @@ Check back frequently as we keep growing this list of checks.
|[SOFTSELECT_HOOK](/dynamic-cell-dropdown)|/physical/path/program.sas|A SAS service (STP or Viya Job) or a path to a SAS program on the filesystem. User-provided values may (or may not) be in this list. Cannot be used alongside a HARDSELECT_HOOK.|
## Special Missing Values
A SAS numeric variable has 28 missing values: the regular `.` and 27 special ones (`.A`-`.Z` and `._`). Data Controller accepts them in a numeric cell as a bare letter - `a` to `z`, or `_`, with no period - and stores the matching special missing in SAS.
A numeric column that carries a date, datetime or time format is the exception. Those cells are edited through a date picker rather than the numeric editor, and the picker accepts only a date - so a special missing cannot be typed into one of them.
The rules treat a special missing as a value for some checks and as a missing value for others:
|Rule|What happens to a special missing|
|---|---|
|NOTNULL|Fails. A special missing is null to a NOT NULL (or primary key) constraint, and a real SAS NOT NULL constraint on the target table rejects it too.|
|MINVAL|Fails - a special missing sorts below every number, so it is below any minimum.|
|MAXVAL|Passes - but the rule is then pointless: a special missing is below every maximum, so the missings pass and the column's real numbers fail.|
|CASE|Not applicable - it is a character rule.|
|ROUND|Ignored - ROUND only rounds values that are numbers, so a special missing is left as typed.|
|HARDREGEX / SOFTREGEX|Checked against the pattern like any other value. Unlike blanks and the plain `.`, special missings are **not** exempt. See [Regex Rules](#regex-rules).|
|SOFTSELECT|Supports special missings - a soft dropdown never blocks a value.|
|HARDSELECT|Supports special missings - the value is matched against the dropdown list like any other value.|
|HARDFORMULA / SOFTFORMULA|The formula returns `#VALUE!` for that row instead of a number, and that is what gets submitted.|
In short, a special missing is **not supported** in a column that carries NOTNULL, MINVAL, MAXVAL or a formula. It is fine alongside the regex rules, the dropdowns, and ROUND.
A primary key column is treated as NOT NULL whether or not the target table carries a physical constraint, and whether or not MPE_VALIDATIONS has a NOTNULL rule for it - a key identifies the row, so a blank and a special missing are both rejected there.
One related gotcha: a range rule's own value must be a number. Put a special missing in `MINVAL` and every cell in the column fails; put one in `MAXVAL` and every real number fails.
## Formula Rules
HARDFORMULA and SOFTFORMULA let you configure a column so that its value is automatically calculated from other columns in the same row - just like a spreadsheet formula. When a user opens the editor, the formula is evaluated live and the result is shown in each cell.