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.
- When to use Advanced Expression Piping
- How to Set Up an Advanced Piping Expression
- Knowing which Question Type to Use
- Available Expressions
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:
- 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.
- Add a new Text Response or Hidden Field, or Section Heading to your form.
NOTE: This will be what the expression is piped into. - 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 - Start your expression by adding 2 curly brackets {{
- Add a space after the second bracket
- Enter your expression based on the list of Available Expressions below.
- After your expression, add a space
- Close your rule with 2 closed curly brackets }}
- Enable Restore Initial Value to ensure your formula always recalculates if a user changes their responses.
You have now created an Advanced Piping formula!
Correct | Incorrect |
{{ expression }} |
{{expression }} {{ expression}} {{expression}} (( expression )) { expression } |
NOTE: The format in which you set up your rule will have an impact on any errors that might occur. For more information, you can refer to How to Troubleshoot your AEP.
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 Type | This question type will... |
Text Response |
|
Hidden Field |
|
Section Heading |
|
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.
- How to Calculate the Sum (SUM)
- How to Calculate the Average (AVG)
- How to Find the Largest Value (MAX)
- How to Find the Smallest Value (MIN)
- How to Concatenate Values in a Form (CONCAT)
- How to Return the First Input Value (COALESCE)
- How to Convert a Floating Point to an Integer (INT)
- How to Convert Values to a String (STR)
- How to Convert a Value to a Single Floating Point (REAL)
- How to Convert a Value to Two Floating Points (REALTWO)
- How to Convert a Value to a Precise Floating Point (PRECISION)
- How to Generate a Random Number between Two Values (RANDIT)
- How to Find the Index of a Character within a String (INDEXOF)
- How to Return a Substring of Characters from a String (SUBSTR)
Additional Resources