Rules and calculations
Show fields only when needed, make answers required or locked, calculate values with formulas, set defaults and use scripts.
Rules make a form adapt to each answer without code: a field appears only when it matters, a total is worked out for you, a date fills itself in. This guide covers conditions, calculated fields, default values and, for the Team plan, form scripts. All of them work the same on the phone, on the web and offline.
Show a field only in some cases
- In the builder, open the field’s Settings (or a section’s settings).
- Tap Show when… and then Add rule.
- Pick an earlier field, a condition and, if needed, a value. For example: “Condition” is any of “Broken, Worn”.
- With several rules, choose Which rules must be met: All rules or Any rule (up to 10 rules).
The field’s settings now read Settings · shown only sometimes. A hidden section hides all its fields.
The conditions offered depend on the type of the earlier field:
- Text: is filled, is empty, equals, contains (capitals and accents do not matter).
- Number and calculated numbers: =, ≠, >, ≥, <, ≤, is filled, is empty.
- Yes / No: is yes, is no, is N/A, is empty.
- Date: before, after, on, is filled, is empty.
- Single choice: is any of, is none of; Multiple choice: includes any of, includes none of.
- Photos: has photos, has no photos. Classification: is within (that level or anything below it).
- Most other types: is filled, is empty.
Good to know:
- A rule only looks at fields above it, so the form reads from top to bottom.
- A hidden field is not required and its answer is not saved. If a rule hides an answer that was already saved, the answer is cleared the next time the record is saved, and the earlier version stays in the record’s history, where it can be restored. When you publish, Monofield tells you how many records this affects.
- A rule the app does not understand (for example, from a newer version) shows the field rather than hiding it.
Required, locked and warnings
In the same Settings, these use the same kind of conditions:
- Required when…: the answer is required only while the condition is true. Saving as a draft does not ask for it.
- Locked when…: nobody can change the answer once the record is saved that way (for example, locked once filled in). It never locks what someone is typing in a new record.
- Locked in these statuses: the answer cannot change while the record is in one of the statuses chosen (for example, Approved). Change the status first.
- Warn on save when… with a Warning text: Save asks Save anyway? while it is true. It never stops the save.
On Photos fields, Proof of place asks that Each photo must have its location, or that it was Taken within this many meters of the record.
Compare with another field or a value
Must be… checks an answer against an earlier field or a fixed value, without a script: “End” on or after “Start”, “Reading” at most “Capacity”.
- In the field’s Settings, under Must be…, tap Add a check.
- Pick the check: At least, At most, More than, Less than, Equal to, Not equal to or Between (for dates and times: On or after, On or before, After, Before…).
- Choose what to compare with: Another field (an earlier one whose answers are of the same kind), A value typed as the field takes it, or Today for dates. Between has a From and a To.
- Optionally write the Message when it is not met. Without it, Monofield writes one that names both fields.
It works on Number, Slider, Rating, Duration, Date, Date with time and Time fields, and can compare with a calculated number or date. A record whose answer does not meet it is not saved, on the phone, on the web and through the API. If the other field is empty or hidden, nothing is checked. A record saved before the check was added keeps its answer until someone changes it. Monofield does not let you publish a check that no answer could meet, or one that names a field that was removed.
Imported XLSForms bring simple constraint comparisons (. >= ${start}, . <= today()) with their constraint_message as this check.
Calculated fields
A calculated field works out its value from earlier fields, like a spreadsheet cell. The result is saved with the record, so lists, exports and reports show it.
- Tap Add field and choose Calculated field (in Basics).
- Write the Formula. Put field names in braces, or use Insert an earlier field.
- Choose the Result type (number, text or date) and, for numbers, the decimals and unit.
- Use Try sample answers or Fill with a saved record to check the result. Nothing is saved.
Formulas use English function names in every language, a decimal point and commas between arguments. Operators: + - * / ^, comparisons = <> < <= > >= and & to join texts.
Examples:
- Line total:
{Quantity} * {Unit price} - Stock alert:
IF({Quantity} < {Minimum stock}, "Reorder", "OK") - Area in hectares:
ROUND(AREA({Plot}) / 10000, 2) - Days until the next visit:
DAYS({Next visit}, TODAY())
The functions, grouped as in Function explanations:
- Logic: IF, AND, OR, NOT, ISBLANK, TRUE, FALSE, IFERROR, SWITCH.
- Numbers: SUM, AVERAGE, MIN, MAX, ABS, ROUND, ROUNDUP, ROUNDDOWN, TRUNC, INT, CEILING, FLOOR, MOD, POWER, SQRT, SIGN, PI, PRODUCT, MEDIAN, COUNT, COUNTA, COUNTBLANK, VALUE, FORMATNUMBER.
- Text: CONCAT, CONCATENATE, TEXTJOIN, LEN, UPPER, LOWER, PROPER, TRIM, LEFT, RIGHT, MID, SUBSTITUTE, REPLACE, REPT, LPAD, RPAD, FIND, SEARCH, CONTAINS, EXACT.
- Dates and times: TODAY, DAYS, YEAR, MONTH, DAY, DATE, DATEVALUE, DATEADD, EDATE, EOMONTH, WEEKDAY, ISOWEEKNUM, NETWORKDAYS, HOUR, MINUTE, TIMEDIFF, TIMEADD.
- Choices: ISSELECTED, COUNTSELECTED.
- Repeatable rows: COUNTROWS, SUMROWS, AVGROWS, MINROWS, MAXROWS, COUNTIFROWS, SUMIFROWS, CONCATROWS.
- Location: AREA (m²), LENGTH (m), LATITUDE, LONGITUDE, DISTANCE (m).
Rules of calculated fields:
- A formula only uses fields above it. Renaming a field never breaks a formula.
- A calculated field is always read-only and never required.
- If a formula cannot be worked out (for example, a division by zero), the field shows “—” and the record still saves.
- If you change a formula of a published form, Monofield asks Recalculate saved results? with the number of records. Earlier values remain in each record’s history.
Default values
Default value fills in a field when a record is created, before anyone types, and never over an answer already given:
- Fixed: always the same value.
- Today: today’s date (Date fields).
- Now: the current time (Date with time, and Time fields).
- Previous value: the last answer you gave this field in this form (if you left it empty last time, the one before). In a group of rows, the row above; the first row, your last row of the group.
- Current user: the name or email of the person creating the record (Text and Email fields).
Can be prefilled from a link lets a Monofield link or QR code fill in the field when a record is created, for example a QR on a shelf that sets “Location = Aisle B”. A field that some people may only read, or that only managers fill in, cannot be prefilled. The values travel in the link itself, so anyone who has the link or the QR code can read them.
Form scripts (Team plan)
For the rare case rules cannot cover, a form can run a script in JavaScript. Most forms need none. Scripts are written on the web, in the builder’s Scripts card, by the Owner and Managers allowed to edit form scripts.
- A script can react when the record opens, when a field changes, when a row is added or saved, when the location or the status changes and before saving. It can fill in fields, limit the options, show a message or stop the save with a message.
- Scripts have no network, no access to other records or to the device. If a script fails, the record is still saved with the normal rules, and the problem appears in the Script log.
- Write with AI drafts a script from a plain description; check it in Test before publishing (see AI features).
- Run scripts turns them off at once, without publishing.
- Phones run the scripts too and show This form has scripts. Without the Team plan, scripts are kept but paused.

Related guides
Still stuck? Write to support@monofield.app