Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Equation to translate certain radio list responses into a summed score

  • jkaufman
  • jkaufman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 4 months ago #129124 by jkaufman
My survey contains a question group of 100 similar radio list questions. I am looking to add an equation question that reads the responses to 10 of these questions and sums the values of their answer option codes.

For example, assuming the radio list questions take the form:
Code:
Q: "What do you think of this statement?"
A: 
  1. "Completely disagree"
  2. "Disagree"
  3. "Somewhat disagree"
  4. "Neither agree nor disagree"
  5. "Somewhat agree"
  6. "Agree"
  7. "Completely agree"

… if survey participant answers "Disagree" for all question codes a1 through a10, I would like to write 20 to the database (2 ("disagree") x 10 (number of questions) = 20). The answers are ordered consistently, so a solution that uses the answer index instead of the answer option code is acceptable. I'm really looking to avoid using JavaScript.

Thank you!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 4 months ago #129126 by DenisChenu
Hi,

Withouts assessments :
{sum(str_replace("A","",Q1.NAOK),str_replace("A","",Q2.NAOK),str_replace("A","",Q3.NAOK), ...)}

With assessments:
{sum(Q1.valueNAOK,Q2.valueNAOK,Q3.value,)}

Or {ASSESSMENT_CURRENT_TOTAL} If you have only this question type.
manual.limesurvey.org/Assessments#Assessment_placeholders

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: jkaufman
The topic has been locked.
  • jkaufman
  • jkaufman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 4 months ago #129131 by jkaufman
That worked exactly as hoped and is very clear. Thank you so much! In case anyone else runs into a similar problem, there is some relevant discussion of sum() and NAOK in Expression Management HowTos .
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose