Calculations, piping and hidden fields
Do arithmetic on answers, repeat an earlier answer in later text, and record values from the link such as a campaign name.
Calculated fields
A calculated field is a number worked out from answers. Add one in the settings panel: select Form settings in the outline, scroll to Calculated fields and choose Add calculated field. Give it a Name and a Formula.
A formula uses numbers, the operators + - * /, parentheses, and references in curly braces.
{q_a1b2c3d4} * {q_e5f6g7h8}
({q_a1b2c3d4} + {q_e5f6g7h8}) / 2
Where do you get the id of a question? From the question's More actions menu, Copy question ID. Each calculated field also shows its own id (c_…) under its formula.
Rules of the formula language:
- Only arithmetic. There are no functions, no text handling and nothing is executed as code.
- A formula can be at most 300 characters.
- Dividing by zero, a missing brace or any other mistake makes the result 0.
- A reference to an earlier calculated field works, so you can build a result in steps. Only fields higher up the list are available.
{@name}refers to a hidden field, treated as a number.- Number, scale, star rating, NPS and slider answers count as their number. An unanswered question counts as 0, and so does a hidden one.
Calculated values are not saved with the response. They exist while the respondent is on the form and drive rules and text.
Using a result
- In show-if rules and routes, calculated fields appear in the question menu as Calculated: name. A route such as "if Total is greater than 500, go to the approval page" is the typical use.
- In text, with the piping syntax below.
Piping answers into text
Write {{q_a1b2c3d4}} in a question title, help text, form description, page title, welcome screen or ending, and the respondent's answer takes its place. Calculated values work the same way with {{c_…}}, and hidden fields with {{@name}}.
Examples:
- A page title:
Thanks, {{q_a1b2c3d4}}. Two quick questions about your order. - A follow-up question:
Why did you give {{q_e5f6g7h8}} stars? - An ending:
Your total comes to {{c_x9y8z7w6}}.
On the page the value updates as the respondent types. Until they answer, the spot shows an ellipsis. The inserted text is always plain text, never markup, so someone typing <b> into a field cannot change how the form looks. For a choice question, the labels of the picked options are inserted. In the builder's outline, a piped title shows as "[Question 3]" so long titles stay readable.
Hidden fields
A hidden field records a value taken from the link, without asking anything. Under Hidden fields in the form settings, type a name and choose Add. Names are lowercased and can contain letters, numbers and underscores, up to 32 characters, and a form can have up to 10.
Then add the value to the link you share:
https://your-formwork-address/f/xk3p9d2a?ref=newsletter&source=march_email
If ref and source are hidden fields, both values are stored with each response, up to 200 characters each. Only names you listed are stored; anything else in the link is ignored.
Where they show up:
- On the response's Details panel as "Hidden: ref".
- As columns named
Hidden: refin CSV, Excel and JSON exports. - On the Insights tab under Hidden fields, as a breakdown of values.
- In rules and routes, as a source called "Hidden field ref", and in text as
{{@ref}}.
The link in the browser can be edited by anyone, so use hidden fields to tag traffic, not to identify or authorise someone.
Campaign tags are automatic
Whether or not you add hidden fields, Formwork also records utm_source, utm_medium and utm_campaign from the link, and the website the visitor came from (the host name only). They appear in Insights under Referrers and UTM sources.
Plans
Conditional logic and calculated fields, and hidden fields, are plan features that are checked when you publish. See Default plan limits.
Updated Sep 30, 2026