Welcome to the LimeSurvey Community Forum

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

Question scores forgotten in next section

  • neilsquire
  • neilsquire's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago - 1 year 5 months ago #233523 by neilsquire
Question scores forgotten in next section was created by neilsquire
I am having a problem where the question scores are forgotten if the survey questions are shown a section at a time. It works if all sections are shown at once. See the "scores" equation in the first section and  and "scores2" in section 6.

To calculate the score, I am using "Q3_1.code" to get the checkbox value and "Q4.code" to get the radio button value. I also tried "Q2_1" to get the checkbox value and "that.Q1" to get the radio button value. Neither way works and the score is forgotten in the next section.

Sorry, I do not know the version of LimeSurvey that I am using. It is a third-party service and the version number does not appear on the admin home screen.

Attached is the survey lss file and formatted EM code.

Any help or pointers are greatly appreciated.
Last edit: 1 year 5 months ago by neilsquire. Reason: Forgot to include the LSS file

Please Log in to join the conversation.

  • neilsquire
  • neilsquire's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago - 1 year 5 months ago #233524 by neilsquire
Replied by neilsquire on topic Question scores forgotten in next section
I also have another problem with the same survey. When I fill out all the questions and submit it, I get an error that reads "One or more questions have not been answered in a valid manner." No questions have an error message beside it. I do not have any CSS that hides error messages. Removing all my custom validation code does not fix this. If I submit the survey again with no changes made, the results are saved.

Does anyone know how to troubleshoot this? I have attached another version of the survey with the custom validation code removed.

According to manual.limesurvey.org/Version_guide, I have version 3.x, but I do not know the exact version.
Last edit: 1 year 5 months ago by neilsquire. Reason: Added version info

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 5 months ago - 1 year 5 months ago #233525 by Joffm
Replied by Joffm on topic Question scores forgotten in next section
Hi,
how do you expect it to work in "group by group" or "question by question" mode,if you try to calculate things that haven't been answered.
e.g. "if(Q3_3...  But Q3 isn't answered at this stage of the survey.
And the data is stored always when proceeding to the next page (the next question, the next group)
So it is obvious that after the first group nothing is stored.

Replace the calculations.

But why are the questions "sores" and "scores2" of type "equation"?
You only display some things (maybe to check) . So use a "text display"

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 5 months ago by Joffm.
The following user(s) said Thank You: neilsquire

Please Log in to join the conversation.

  • neilsquire
  • neilsquire's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago #233528 by neilsquire
Replied by neilsquire on topic Question scores forgotten in next section
Okay, so I just need to move the equations down to just before section 5 where the calculation will be used for branching?

Any ideas regarding the validation error on submit?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 5 months ago #233530 by Joffm
Replied by Joffm on topic Question scores forgotten in next section
Hi,

I also have another problem with the same survey. 

I am not surprised at people saying "I search the forum, but didn't find" if a question appears under a really misleading topic.
You should have opened a new thread with a better topic.

Well,
1. lower the number of your questions.
As far as I saw there is no need to double each question (normal and ASL)
The only difference is the display of the video and a different css class.
Use tayloring like
{if(QMinus.NAOK==1,"[code to display the video]","")}
and the same with the css classes.

The way you do it now, you could also split the survey into two (one normal, one ASL) and in the "decider survey" you link by end-url to one of the two.
This is even better than you do it now.
Now you have all answers to one question in different columns of the dataset. Then you can easily merge the two datasets.
But tayloring is the "buzzword"

2. Is it really necessary to display "all on one page"?

3. I could not reproduce your issue in both of your provided surveys (all on one page). Seem to be some settings in php.ini

And a remark at last: Don't use the Condition Builder, use ExpressionManager instead. Easier, faster to edit, more flexible.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: neilsquire

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 5 months ago - 1 year 5 months ago #233571 by Joffm
Replied by Joffm on topic Question scores forgotten in next section
And another remark.
You always use the function "countifop" with the equal sign.
But this is a simple "countif".

"countifop" you may use here
Instead of this
countifop("==","1",Q4.code) + countifop("==","2",Q4.code) + countifop("==","4",Q4.code)
this (after changing the codes of "No -> 4" and "Sometimes -> 3"
countifop("<","4",Q4.code)

Similar here
countifop("==", "Y", Q39_2.code) + countifop("==", "Y", Q39_3.code) + countifop("==", "Y", Q39_4.code) + countifop("==", "Y", Q39_5.code) + countifop("==", "Y", Q39_24.code)

countif("Y", Q39_2.code,Q39_3.code, Q39_4.code, Q39_5.code, Q39_24.code)

To show that you can shorten your equations tremendously.
But you have to get used to these functions and I should recommend to the variables "self" and "that".
With more suitable codes you may shorten even more.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 5 months ago by Joffm.
The following user(s) said Thank You: neilsquire

Please Log in to join the conversation.

  • neilsquire
  • neilsquire's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago #233583 by neilsquire
Replied by neilsquire on topic Question scores forgotten in next section
Thank you so much Joffm for your quick responses and code suggestions.

Moving the equation question down fixed the question scoring issue.

I tried your tayloring suggestion by doing {if(Qminus1.code == "A1", '<div></div><div><p>Some text</p></div>', "Some other text")}. I have to make sure there are no line breaks or else it fails validation. However, the visual HTML editor likes to put line breaks back in.

The countif is a great idea when refactoring my logic. How about if I want countif not "Y"?

I also never understood the difference between {Q3_1.code} and {Q3_1} for getting the value of checkboxes and {Q4.code} and {that.Q4} for radio buttons. What is the difference between "that" and ".code"?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 5 months ago #233584 by Joffm
Replied by Joffm on topic Question scores forgotten in next section
 

However, the visual HTML editor likes to put line breaks back in.

Absolutely right.
And it likes to changes quotes, and...
This editor has its own ideas. Therefore we suggest to use the source code editor.

I also never understood the difference between {Q3_1.code} and {Q3_1}

As the manual says:
[url] manual.limesurvey.org/ExpressionScript_-...#Access_to_variables [/url]
Qcode an alias for Qcode.code.
Meaning: There is no.

What is the difference between "that" and ".code"?

"self" and "that" is something different. These are special variables, while "code". "value", "gseq" and all the others are properties.
[url] manual.limesurvey.org/ExpressionScript_-....22that.22_variables [/url]
They are only useful in question types where there are subquestions.
What do they do?
"self" always refers to the question itself
So, if the question is Q1 with subquestions SQ001,SQ002,...
the term "{sum(self)}" would be expanded to {sum(Q1_SQ001,Q1_SQ002,Q1_SQ003,...)}
In an question of type array (numbers/text) again with subquestion codes SQ001, SQ002 in x- and y-axis this would expand to
{sum(Q1_SQ001_SQ001,Q1_SQ001_SQ002.Q1_SQ001_SQ003,Q1_SQ002_SQ001)]
Not really interesting.
But if you only want to calculate certain rows, columns, subquestions you get the full power of them.
E.g. if you code the y-axis Y001,Y002,... and the x-axis X001,X002,... you calculate the sum of the third column by {sum(self.sq_X003)}
or in an array with you may have three types of items to rate (items related to cars, items releted to buses, items related to trains)
you would code
C01, C02, C02,...
B01,B02,...
T01,T02,...
Now you can get
the total sum by {sum(self)} 
the sum of car items by {sum(self,sq_C)}
the sum of bus items by {sum(self,sq_B)}
In short if the code of the cells contains a C (or B) it is included in the calculation
So if you think first about a suitable coding you may save a lot.
"self" you mostly use in validation equations.
Now "that" refers to a different variable, as in your case
So you only have to add the question code, like
{sum(that.Q1.sq_C)}

How about if I want countif not "Y"?

How is a multiple question stored?
If selected: "Y"
If not selected: ""
Meaning
You count the selected items by "countif("Y",that.Q1)", the not selected items by "countif("",that.Q1)}
 
And as you only want to count special items of a multiple question I said "code with useful codes"

And there is also "sumif(op)".

If there are (sub)questions in your calculation that may be hidden because of relevance equations don't forget "NAOK"

Just for fun I will try to shorten your calculations and show it.
But later.

Joffm



 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose