Two Values That Belong Together
Some requirements are not about a single field — they are about the consistency between two fields.
For example: - A classification number must match its corresponding description - A type mark must follow the pattern implied by the assembly code - A door width code must correspond to the correct opening dimension
These cannot be expressed as a single "not empty" or "in list" check. The relationship between the two values is what matters.
The pattern
DAQS validates one value at a time — the valueToValidate. But that value can be a computed expression using data from the filter output.
The approach is to compute the expected value inside the filter, then validate that the actual value matches it — or to look up the expected value from a reference table.
Example — lookup table validation
A classification system has a table where every number has a corresponding description. The rule checks that the description on the element matches what the number says it should be.
The lookup is expressed in the valueToValidate query using a reference dataset passed into the rule:
$exists($[DESCRIPTION='{{UniclassEFDescription.value}}'].NUMBER)
? $[DESCRIPTION='{{UniclassEFDescription.value}}'].NUMBER
: ''
$exists($[NUMBER='{{UniclassEFNumber.value}}'].DESCRIPTION)
? $[NUMBER='{{UniclassEFNumber.value}}'].DESCRIPTION
: ''
These expressions look up the expected counterpart value from the reference table. If the number is known, the expected description is retrieved. If the element's actual description does not match, the validator fails.
What the filter must return
For this pattern to work, the filter must expose both values:
{
"id": id,
"type": type,
"name": name,
"UniclassEFNumber": $getSharedParam($, "UniclassEFNumber"),
"UniclassEFDescription": $getSharedParam($, "UniclassEFDescription")
}
Both fields are in the output. The valueToValidate expression can then reference both.
When to use this pattern
Use it when:
- Two fields must be consistent with each other according to a standard
- A value can only be correct in the context of another value
- A lookup table defines valid combinations
Do not use it when a simple "in list" check on a single field is enough. The two-value pattern adds complexity — earn it.
Important constraint
The valueToValidate query only has access to what the filter returned for the current element. It cannot query the full dataset at validation time.
If the lookup table is a reference dataset passed into the rule, it is available as $. If the table lives in the model data, it must be resolved in the filter and included in the output.