Assign Values to Text Responses and Calculate a Total Score
Sometimes you need to ask survey questions where the participant selects a verbal response (like “Very satisfied”), but you need to convert that response into a numeric value (like 4) to calculate a total score.
This gets tricky when you’re using custom variables because you can’t directly assign values to custom variables.
In this tutorial, you’ll learn how to:
-
Collect text-based survey responses
-
Translate each response into a numeric score
-
Calculate a total score across multiple questions
-
Use custom variables to track and store responses along the way
By the end, you’ll be able to score patient satisfaction surveys (or similar tools) even when using custom, non-numeric variables.
Steps to Implement:
1) Create 2 custom variables for the question. One single select variable to capture the responses in words and one to capture the responses as a number.
2) In your survey, create a radio group question and tie it to the single select custom variable. This will be the question the participant selects on the survey.
3) Create a single-line input question, change the input type to a number format, then link it to the number version of the custom variable. Make this question invisible.
Pro Tip: You can organize related questions in a panel to keep them visually organized. This also makes it easier to replicate. Simply copy the whole panel when you need to create additional question in a similar format.
4) Create a survey logic statement for each response option in the text version of the question to set the numeric value in the hidden question.
Make sure you include a logic statement for an empty value. This will help ensure your logic statements are triggered again if the respondent changes their answer.
5) Create a number type custom variable for the total score.
6) Add an Expression type question to your survey and link it to the total score variable.
7) Enter a calculation to add each of the score values. Make sure you enclosure each question name in curly braces { }.