Drive a field with a rule: visibility, items, error — gull system handbook
Dynamic field properties in gull system: Visible, Enabled, Items, Error, Default value, MIN and MAX driven by a rule, and what a broken rule does.
Drive a field with a rule: visibility, items, error
Every value in the Behaviour group, plus the default value, MIN and MAX, can be a rule instead of a number. The orb next to the row switches it.
The orb: static value or rule
- Hollow orb = a static value ("A static value. Click to turn it into a rule."). Clicking turns the row into a rule and opens the rule editor.
- Filled orb = a rule. Clicking goes back to a static value; the app asks "Discard the rule and go back to the static value?".
- Next to the row is the live result with default values: shown / hidden, enabled / disabled, no items, fine.
What can be driven
- Row: Visible - The rule returns: TRUE = show, FALSE = hide - When the rule fails: the field stays visible
- Row: Enabled - The rule returns: only an exact TRUE enables - When the rule fails: the field stays enabled
- Row: Items - The rule returns: a pipe-separated list, e.g. `LISTALLDISTINCT(Prices, 2)` - When the rule fails: no items
- Row: Default value - The rule returns: a value - When the rule fails: —
- Row: MIN, MAX - The rule returns: a number - When the rule fails: —
Field rules read the form's other fields by name (`[Type] = "A"`), the form variables and the name of a Steps element, which returns the label of the page on show. Library tables are available too.
Examples
- Hide a field until a type is chosen. Visible = `[Type] <> ""`.
- Offer only the colours available for the chosen material. Items = `LISTALLCONDITIONAL(Finishes, 2, 1, "=" & [Material])` — the Finishes table has the material in column 1 and the colour in column 2.
- Refuse a combination that cannot be made. Error = `IF([Length] > 3000 AND [Thickness] < 2, "Lengths over 3 m need 2 mm", "")`.
- A maximum from another field. MAX = `[Width] * 2`.
A hidden field sends its default value. Hiding is about the screen, not the order. When a container or a Steps page disappears, everything inside goes with it — the parent wins.
A field that vanished because of a broken rule is one you would never see — which is why a broken rule leaves the field visible. To know a rule is failing, test it in the editor: green is valid, red is not, and Evaluation → Steps shows where it fails.