Welcome to the LimeSurvey Community Forum

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

Default answers in a multiple short text question: expression refer to equation

More
9 years 17 hours ago #118414 by Sev
I am using the following system to filter an array question from a (hidden) multiple short text question with default answers, taken from previous equation questions.

Q0. Dual scale question with drop-down
Q11. Equation 1 joins elements from previous question Q0
Code:
{if(Q0_SQ001_0=="0","",join(Q0_SQ001_0.shown," and ",Q0_SQ001_1.shown))}
Q12. Equation 2 joins elements from previous question Q0
Code:
{if(Q0_SQ002_0=="0","",join(Q0_SQ002_0.shown," and ",Q0_SQ002_1.shown))}
Q13. Equation 3 joins elements from previous question Q0
Code:
{if(Q0_SQ003_0=="0","",join(Q0_SQ003_0.shown," and ",Q0_SQ003_1.shown))}
Q2. A multiple short text question using default answers Q11, Q12 and Q13 equations
SQ001
Code:
{if(!is_empty(Q11),Q11,’’)}
SQ002
Code:
{if(!is_empty(Q12),Q12,’’)}
SQ003
Code:
{if(!is_empty(Q13),Q13,’’)}
Q3. An array question for which the previous Q2, multiple short text question, is used as an array filter

My problem stands with question Q2, the expressions to fill in the default answers using EM.
When I run the survey, Q11, Q12 and Q13 can be shown easily in Q2 or Q3's question text or in its sub-questions, using the expression {Q11}. However instead of showing fully, the default answer of Q11 (as well as Q12 and Q13) only shows “and”, the only non-formula/written element of the joint() expression in the equation question Q11.

I actually had succeeded to make it work in a survey I created last year B) but which is now expired. However for some reason (even though the structure seems the same) I cannot make it work this time. :(
I have looked on forums and tried to use different EM expressions with the question code instead, or to write Q11.shown, or to refer to the Q2 sub-question, itself referring to Q11.

I would appreciate any help on the matter.
Thank you!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 17 hours ago #118415 by holch
Why don't you get the code from the expired survey and use it in the new survey?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
9 years 15 hours ago #118417 by Sev
The code I mention is the same one I used in the old survey. The new survey is a copy of the old original one, to which I made some changes. I tried to copy again the same codes, I even re-imported the same question.

Also, whether you move the hidden question to its own question group (between Q1 and Q3) or if it remains just before Q3 does not seem to make a difference. Btw, Q0,Q11,Q12,Q13 are in their own question group (in order to populate Q2, in the subsequent question group).
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 14 hours ago #118418 by holch
did you check if all the codes are the same after copying the survey? They should, but you never know...

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
9 years 13 hours ago #118420 by Sev
I have checked each line of each question, and surveys are identical.

Ah! Just found the problem.
I had put the survey setting for Show question index/ allow jumping to "Full" (easier to navigate through long surveys), and that probably blocked links between default answers expression from previous questions.

I changed it "incremental" and now it works!!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose