Hi everyone and thanks for the great work and support.
I'm new to LimeSurvey and have read through the manual and many forum posts trying to learn further than just doing the obvious simple things. I wish I could find a beginner step by step guide to learn LS better.
I appreciate your help on this one to start with:
I have a number of radio list type questions (Q1, Q2, Q3,..... etc) and each question has three different answers (A1, A2, A3). After answering all questions (selecting one answer, A1 or A2 or A3) I need to sum total all selected A1 answers and display the result with some text. I also need to repeat same with A2 and A3.
I tried the following in an equation type question but it's not working. It highlights the Q_A variables as undefined. What am doing wrong ?!
So your A1 total score is : {sum(Q1_A1, Q2_A1, Q3_A1, Q4_A1, Q5_A1)}
Your A2 total score is : {sum(Q1_A2, Q2_A2, Q3_A2, Q4_A2, Q5_A2)}
Your A3 total score is : {sum(Q1_A3, Q2_A3, Q3_A3, Q4_A3, Q5_A3)}
Hi, Moonlight,
IMHO LS doesn't know, what to sum, if your answer codes are just "A1", "A2", or "A3" and you say "sum(Q1_A1,Q2_A1)".
So, set your answer codes to "1", "2", "3", and change the equation to
QResult1= {sum(if(Q1==1,1,0), if(Q2==1,1,0), if(Q3==1,1,0))}
QResult2= {sum(if(Q1==2,1,0), if(Q2==2,1,0), if(Q3==2,1,0))}
...
Then you have the count of the answers in the respective variables.
Best Regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
to add something.
You can display the results directly in a question by saying:
The result of "1" is: {sum(if(Q01==1,1,0), if(Q02==1,1,0), if(Q03==1,1,0))}
The result of "2" is: {sum(if(Q01==2,1,0), if(Q02==2,1,0), if(Q03==2,1,0))}
in the question text.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Moonlight7, sjsls2016
Here is another issue.
I used the same for a multiple choice question (mCQ) this time but it doesn't seem to be working !
Each sub-question/ choice has a different score when checked. I need to sum the scores of all checked choices.
e.g. if SQ001 was checked it scores 25; SQ002 scores 20, SQ003 scores 4, and SQ004 scores 5.
There are many more choices but this is for demonstration purposes now.
I used the following in an equation type question but nothing is happening !
Show screenshot please : OIf you have error : EM show the exact error type in "title" of the error ...
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
DenisChenu wrote: Show screenshot please : OIf you have error : EM show the exact error type in "title" of the error ...
Denis
Thanks so much Denis, I fixed it
your way
but I still like to learn why the one here is not working since this seems the only way for me to learn advanced tricks in LS (by trial and errors and posting here).
Thanks so much for all you guys for your kind support.
Well, it is not very easy for us to help just with the equation. Because there could be many errors (e.g. a typo in the question code, etc.).
So either a lss file with the example or at least a screenshot of the error message might help. We can't rebuilt every situation that is posted on the forum.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
Thanks I tried removing it, it also rendered an error, I tried retyping the codes manually and when I make a mistake I don't use the mouse pointer to insert in the error but rather backspace on everything until I erase the error and correct it. Because strangely I notice it was the cause of the problem. Very strange problem. Thanks.