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]
www.limesurvey.org/manual/ExpressionScri...#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]
www.limesurvey.org/manual/ExpressionScri....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) B)](/media/kunena/emoticons/1.png)
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