Welcome to the LimeSurvey Community Forum

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

Simple Sum derived from three previous equations not working

  • orlacaffrey
  • orlacaffrey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago #227643 by orlacaffrey
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 5.3.9
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi
I am collecting information from the DASS21 instrument that measures anxiety, depression & stress. From the instrument I created:
DASSASS: instrument is presented as an array with 21 items. Each with 4 possible single choice answers
StressScore1: an question given total value of Stress dervived from the answers from the DASS-21 questionnaire (an array style question)
AnxScore1:an question given total value of Anxiety derived from the answers the DASS-21 questionnaire (an array style question)
DepScore1;an question given total value of Anxiety derived from the answers the DASS-21 questionnaire (an array style question)

Now I would like to 
a) calculate the Total Score of DASS21 answers by creating TotalScore
I have created a equation that seems to be valid {sum(StressScore1, AnxScore1,DepScore1)} but it doesn't calculate values that appear in the preview group question page

b) Id like to identify the number of non answers for each profile (Anxiety, Depression & Stress) but again the equatioin seems valid but provides only 1 as an answer even when all are unanswered on the test page
The code I used as an example for  the Number of Stress Questions left unanswered is:
{sum(if(is_empty(DASSASS_DASSS1),1, if(is_empty(DASSASS_DASSS2),1, if(is_empty(DASSASS_DASSS3),1, if(is_empty(DASSASS_DASSS4),1, if(is_empty(DASSASS_DASSS5),1, if(is_empty(DASSASS_DASSS6),1, if(is_empty(DASSASS_DASSS7),1,0))))))))}

Can anyone please help? I have  attached the question group so you can see what I've done

Cheers
Orla

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago - 2 years 9 months ago #227645 by Joffm
Please, only send lss exports, neither lsq nor lsg.

Copy the survey, remove everything not related to your question, export as lss.

Your shown equation is wrong.
You use a nested IF, your second IF is the FALSE part of the first.

Has to be.
{sum(if(is_empty(Q1),1,0), if(is_empty(Q2),1,0), if...)}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 9 months ago by Joffm.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago - 2 years 9 months ago #227646 by Joffm
Hi,
use less "stupid" answer option codes like yours "D21A0", "D21A1",...
Use
0: Did not apply to me at all
1: Applied to me to some degree or some of the time
2: Applied to me to a considerable degree or a good part of the time
3: Applied to me very much or most of the time

you have these three easy equations:
Stress: {sum(that.DASSASS.sq_DASS.NAOK)*2}
Anx: {sum(that.DASSASS.sq_DASA.NAOK)*2}
Dep: {sum(that.DASSASS.sq_DASD.NAOK)*2}
​​​​​​​
NAOK is important, because the "sum" will fail if one of the questions is not answered (therefore "No Answer is OK")
Read the manual about implemented functions and  "that", "self" and the meaning of "sq"
[url] www.limesurvey.org/manual/ExpressionScri...mplemented_functions [/url]
[url] www.limesurvey.org/manual/ExpressionScri....22that.22_variables [/url]
and the correct use of the IF-statement.

And do not enter HTML code in an equation. You only calculate something.
If you want to display the value use a question of type "text display"

Joffm

If you insist on your answer option codes you may use these equations:
Stress: {2*sum(countif('D21A1',that.DASSASS.sq_DASSS.NAOK)*1, countif('D21A2',that.DASSASS.sq_DASSS.NAOK)*2, countif('D21A3',that.DASSASS.sq_DASSS.NAOK)*3)}

Anx: {2*sum(countif('D21A1',that.DASSASS.sq_DASSA.NAOK)*1, countif('D21A2',that.DASSASS.sq_DASSA.NAOK)*2, countif('D21A3',that.DASSASS.sq_DASSA.NAOK)*3)}

Dep: {2*sum(countif('D21A1',that.DASSASS.sq_DASSD.NAOK)*1, countif('D21A2',that.DASSASS.sq_DASSD.NAOK)*2, countif('D21A3',that.DASSASS.sq_DASSD.NAOK)*3)}

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 9 months ago by Joffm.
The following user(s) said Thank You: LISHANGQI

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose