Looking to add values collected earlier in a survey? Strictly speaking, performing mathematic functions in a survey requires custom scripting; however, if you have a few values that you wish to add, you can leverage our Continuous Sum question to achieve this.
Step 1: Add Continuous Sum Question
To set this up, add a Continuous Sum question to a page that follows the questions in the survey in which the values you wish to sum are collected.
Because we will be hiding this question from displaying to survey respondents you can enter whatever works for you internally as the question title.
Step 2: Add Options and Insert Merge Codes
Next, you will need an option for each field you wish to include in the sum.
- In the Option field, again, you can enter whatever makes sense to you internally as this question will not display to respondents when we are finished.
- In the Default Value field enter the merge code for each question's entered value you wish to include in the sum.
- Not sure how to find the merge codes for your questions? The easiest way to find the merge code for each of your questions is to use the merge code helper available in the question title field. You can insert your merge codes into the question text and the copy/paste those into the Default Value fields.
Step 3: Test to Make Sure the Sum is Correct
Now, you will want to record a couple of responses using Preview to confirm that the sum is correct.
Step 4: Hide the Continuous Sum Question from Respondents
As a best practice, we recommend using sg-hide with our Javescript Autosubmit action.
Once you've confirmed that the sum is working correctly you are ready to hide the question from your respondents.
- Edit the Continuous Sum question and go to the Layout tab.
- Locate the CSS Class Name field and enter the following:
sg-hide
.
Need to use this value elsewhere in the survey? There isn't a built in way to achieve this but we have a workaround script.