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

Open
hermes wants to merge 5 commits from docs/special-missing-rule-behaviour into main
Showing only changes of commit 4d53ced89c - Show all commits
+24 -2
View File
@@ -23,12 +23,12 @@ It is possible to configure a number of other rules by updating the MPE_VALIDATI
## Configurable Checks ## 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| |Rule Type|Example Value |Description|
|---|---|---| |---|---|---|
|CASE|UPCASE|Will enforce the case of cell values. Valid values: UPCASE, LOWCASE, PROPCASE| |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| |MINVAL|1|Defines a minimum value for a numeric cell|
|MAXVAL|1000000|Defines a maximum 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. | |READONLY|(defaultval) |Renders the column read-only in the editor. The defaultval is used when rows are added. |
@@ -45,6 +45,28 @@ 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.| |[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.
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|Passes - a soft dropdown never blocks a value.|
|HARDSELECT|Fails - the strict membership test cannot match it (the dropdown list for a numeric column holds numbers).|
|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, HARDSELECT or a formula. It is fine alongside the regex rules, a soft dropdown, and ROUND.
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 ## 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. 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.