Welcome to the LimeSurvey Community Forum

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

Issues with QCode.shown

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 1 week ago - 6 years 1 week ago #165453 by davebostockgmail
Issues with QCode.shown was created by davebostockgmail
Good Afternoon

I have looked high and low for an answer to this and I cannot figure it out ... wondering if anyone had a solution or just tell me I am doing this wrong.

Issue : I have a multi choice question followed by a single choice question followed by a text display ... so to keep things simple for the participant I have filled the single with the answer from the multi if only one answer is given. That seems to work perfectly as does the follow on display. However when I hide the single (if only one answer at the multi) the text display does not work.

Example.
Q1 - Which of these colours do you you like - Select all that appply
Red
Green
Blue

SetQ2 Equation (Hidden by default)
{Q2=if(Q1_1=="Y",1,if(Q1_2=="Y",2,if(Q2_3=="Y",3,"")))}
Relevance : count(that.Q1.NAOK) ==1

Q2 - And which is your favourite - Filtered to only show those selected in Q1 and Skipped via relevance if only one answer
Red
Green
Blue
Relevance : count(that.Q1.NAOK) >1

Q3 - Why is {Q2.shown} your favourite?


So if I have 2 answers in Q1 it shows Q2 correctly and then shows the answer to Q2 in Q3
If I do not have the relevance filter on Q2 and only select one answer in Q1 ... it shows Q2 pre-filled correctly and then shows the answer in Q3

If I use the relevance in Q2 and only select one answer in Q1 then it hides Q2 correctly BUT does not show the answer in Q3.

Any one understand why this would happen?

Much appreciated

EDIT : This is on Version 2.6.4-lts
Last edit: 6 years 1 week ago by davebostockgmail. Reason: Added Version Number
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 week ago #165459 by Joffm
Replied by Joffm on topic Issues with QCode.shown
Hi,
in my opinion this is normal behaviour.

Because of the relevance Q2 is not available.

Always the best is to activate the survey, enter some well defined data and have a look at the answer table.

You see the following:


You see, in case of only one selection in Q1 (I called it M1) there is no value in Q2(M2).

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 1 week ago #165460 by davebostockgmail
Replied by davebostockgmail on topic Issues with QCode.shown
Thanks ... I can understand why this is seen as normal behaviour - I will just create a hidden question and populate that to do what I need and then post populate the 2nd question before processing the data ... I think I may have just been being a little lazy and hoping for the best.

Thank you for your help Joffm
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 week ago - 6 years 1 week ago #165462 by Joffm
Replied by Joffm on topic Issues with QCode.shown
But you can manage that.

Insert a Questin Q2a which you hide by the css class "hidden".
Your equation fills this question in case of only one selection in Q1.

If more than one color was selected in Q1 show the normal question Q2

In Q3 you say:

Why is {if(!is_empty(Q2),Q2.shown,Q2a.shown)} your favourite?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 1 week ago by Joffm.
The following user(s) said Thank You: davebostockgmail
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 1 week ago #165465 by davebostockgmail
Replied by davebostockgmail on topic Issues with QCode.shown
Perfect
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose