Skip logic & derivations
A form does not have to show every field to everyone all the time. Two tools make it “live”: skip logic (display conditions) shows a field or section only when it is relevant, and derivations fill computed fields in automatically — with no manual entry. Both are configured in the CRF Builder and live in the design version together with the forms.
Display conditions (skip logic)
Section titled “Display conditions (skip logic)”For a field or section, the builder’s inspector sets a Display condition — an expression over other fields of the same form. The rule is simple: true — the element is visible, false — hidden, an empty condition — always visible.
The classic example: an “If yes — please specify” field is visible only when the neighboring field is answered “Yes”. The coordinator sees a short form until the conditions reveal the additional fields.
PREGNANT == 'Y'A condition can be assembled visually — as “field — operator — value” rows: for date fields the operators read as words (is before · is not after · is after · is not before), and a field can be compared not only with a constant but also with another field of the form. A complex condition is set with a formula in advanced mode.
- A hidden field does not count as unfilled: it does not prevent completing the form, and the “field is required” check does not fire on it. A hidden section hides all of its fields.
- Conditions are recalculated instantly — right during entry, without saving.
If a field hid while already holding a value
Section titled “If a field hid while already holding a value”Skip logic never deletes data silently. If a value was entered and the answer in the controlling field later changed so the field hid, the value stays in the database and the coordinator sees a warning: “Hidden by a condition but holds a value”.
From there a human decides, not the system: the “Clear (with a reason)” button clears the value — with a mandatory reason, an audit-trail record and the usual consequences of a data edit. Or the coordinator restores the controlling answer — and the field is visible again, value and all.
Derivations (auto-fill)
Section titled “Derivations (auto-fill)”A derivation is a rule of the form “this field is computed from other fields”: for example, BMI from height and weight. Such rules are created in the Auto-filled fields block of the Logic tab: you pick a target field and write an expression. A ready derivation is edited in place — clicking it opens the editor.
round(num(WEIGHT) / (num(HEIGHT) * num(HEIGHT)), 1)How it works during entry:
- the target field carries the “auto-filled” badge and is closed to manual entry — the system fills the value in;
- the calculation happens instantly as the source fields are entered — the coordinator does not need to press anything;
- while the source fields are empty, the computed field stays empty.
The expression language: a quick reference
Section titled “The expression language: a quick reference”Display conditions, derivations and edit checks are written
in one compact expression language. Fields are addressed by their OID; comparisons
(==, !=, <, <=, >, >=), arithmetic (+, -, *, /) and the and / or /
not connectives are available.
| Function | What it does |
|---|---|
is_empty(x) |
true if the field is empty |
num(x) |
the numeric value of a field |
days_between(a, b) |
the number of days between two dates |
round(x, n) |
rounding to n digits |
ref('FORM', 'FIELD') |
the value of a field of another form |
ref('VISIT', 'FORM', 'FIELD') |
the same with the visit pinned — for cross-form checks |
What “true” means depends on where the expression is used:
| Where it is used | True means |
|---|---|
| An edit check | a violation — the check fires (a block or a query) |
| A display condition | the element is visible |
| A derivation | not a condition but a formula — its result is written into the target field |
The editor in the builder validates the expression on the fly: right under the input you see “Expression is valid” or the specific error, plus the list of fields the expression depends on. Broken expressions will not get past submitting the version for review either.