## How to control survey flow using mathematical operation

Expressions help you to evaluate the respondent, based on the answers provided by them. You can create a mathematical formula using Expressions and show the results in the “Thank you” page. You can also see the calculated values in reports.

For instance, you want to calculate the quality score of a particular process in your organization. You can enable scoring for each answer and use Expressions to calculate the results based on the Mathematical formula you had defined.

The following question types support Expressions:

- Opinion scale
- Rating
- Number
- Multiple choice
- Picture choice
- Drop-down

Expressions lets you control the survey flow when used with display logic, skip logic or question piping. See the calculated value only in your reports by keeping it a hidden variable or use it as a filter value to get value-driven reports.

Let’s see how it works:

1. Click on the global variable icon from the top bar. A pop-up window will open. Select Expressions tab and click on Create Expression button.

2. Give a name to the expression and add formula you want to execute during the survey. You can add the variables by clicking on the dollar ($) sign.

3. Click on Validate and save button to save the created expression. All Expressions created for the survey will be listed in the same pop-up window.

Once you have finished adding expressions, go to the questions that you want your expressions to be used. You have three options- Display logic, Skip logic, and Question piping. Choose the one that suits the mathematical operation you want to employ. For this example, if you are using Display logic.

1. Select logic and select the expression that you want to use.

2. Add the desired condition for the responses.

3. Preview the questions and proceed

### Use Case:

You run a cake shop and want to collect information about the Cake that the customer prefers to order to show the final price.

1. The first question can be the Cake flavour that the customer wants to order - Vanilla, Strawberry, Butterscotch, or any flavour.

2. Now that we know the cake flavour, we should also get to know the cake quantity. Irrespective of flavours, the price of the cake varies only with the quantity.

- For 0.5 kg = $15
- For 1 kg = $30

3. So, in this case, our next question can be a Multiple choice question, asking the quantity of cake the customer prefers to order along with the price mentioned right below using scoring.4. The third question is to know what kind of toppings the customers prefer on the cake. The prices for the toppings are:

- Nuts = $5
- Gems = $10

5. Now that the questions are created, we should also create the corresponding Expression to add all the prices correctly.

6. The Expression which we've created is

**$amount = Score Q4 (Kgs of Cake they chose) + Score Q5 (The cost of toppings) **

7. Now we should make sure of three things.

- To make sure if the currency is chosen rightly.
- To make sure if the
**Expression**is selected as the payment method. - To make sure if the
**valid Expression**is selected from the dropdown (In case if we have created multiple expressions)

8. Now we’re good to go. When the survey is shared and let's say a customer wants 0.5 kg of Vanilla cake with gems topping, the total amount that the customer has to pay will be $25, which will be displayed on the payment page.

9. You can display the eligible cashback amount in the final page using Display logic, skip logic or question piping.

### Note:

- Expressions can only run numerical values which means, you can use the feature only for numerical responses or the ones that can be assigned scores.
- The Expression value cannot be calculated if the respondent skips (using Logic or optional questions) any question that is used to calculate the expression. Please ensure skip and display logics are used carefully while applying expressions.

Please reach out to us if you have any questions. We are just a chat away!

## Comments

0 comments

Please sign in to leave a comment.