How to Create Calculations in your Forms

If you are looking to calculate responses or scores in your form, you can use our Advanced Expression Piping (AEP) functionality. AEP lets you perform mathematical calculations in your form, display the output to users, and record it in responses. This article will walk through the basics of using Advanced Piping within your forms. 

Use AEP to do things like:

  • Calculate a weighted score for a reviewer ranking
  • Perform calculations on values your users enter into your form
  • Initiate advanced branching logic based on the sum of a calculation, for example, an action occurs in the form based on a specific result.
  • Set up True/False statements based on data your users enter in.

AEP lets you create expressions that use operators or functions to evaluate or manipulate data. The data can come from form responses or be passed from custom fields. Use AEP syntax to record the result of your expression in your responses or use the output to initiate branching logic.

AEP Syntax/Rule: {{ expression }}

For different available Expressions you can refer to the Available Expressions section below.

In order to set up your expressions on your forms:

  1. Add an Identifier to your questions that you wish to use within the expression. Setting identifiers to your questions will allow to convert question responses into values.
  2. Add a new Text Response or Hidden Field, or Section Heading to your form.
    NOTE: This will be what the expression is piped into.
  3. If you added a Text Response you will need to create the expression within the Initial Value field
    If you added a Hidden Field you will need to create the expression within the Hidden Value field
    If you add a Section Heading, you will need to create the expression within the Description or Title
  4. Start your expression by adding 2 curly brackets {{
  5. Add a space after the second bracket
  6. Enter your expression based on the list of Available Expressions below.
  7. After your expression, add a space
  8. Close your rule with 2 closed curly brackets }}
  9. Enable Restore Initial Value to ensure your formula always recalculates if a user changes their responses. 

You have now created an Advanced Piping formula!

{{ expression }}{{expression }}
{{ expression}}
(( expression ))
expression }

Mentioned above in How to Set Up an Advanced Piping Expression, you can use three possible question types (Text Response or Hidden Field, or Section Heading), but which one should you use and when?

Question TypeThis question type will...
Text Response- Display the calculation to your users
- Be available in Reports
- Allow your users to edit the calculated total before Saving
Hidden Field- Hide the calculation from users
- Be available in reports
Section Heading- Display the calculation to users as read-only text
- Not be reportable

Often times the Hidden Field and the Section Heading will be used together, to ensure that the users can see the calculation result, not be able to edit it, and allow you to pull reports on the total. 

Down below is a directory to how the response data can be manipulated with AEP. The functions use response data from basic question types such as multiple choice and checkbox as well as advanced question types like Multi-Column questions.