Welcome to the LimeSurvey Community Forum

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

Hidden question groups are rendered as blank pages

  • VHVAllgemeine
  • VHVAllgemeine's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 4 weeks ago #265851 by VHVAllgemeine
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 6.5.16
Own server or LimeSurvey hosting: Limesurvey hosting
Survey theme/template:fruity
==================

Hello,

I am currently working on a survey that should display 2 out of 6 questions at random. The randomization and relevance filtering works fine, but limesurvey renders an empty page (with a working next button) after the random questions. A lss-file of a demo-survey showcasing the behaviour is attached.

About the filtering logic:
  • The survey is set to display group by group
  • The first question goup includes an equation named counter and sets it to "0": 
    • if(is_empty(counter.NAOK), 0, counter.NAOK)
    • hidden via css-class d-none
  • Next up are 6 question groups in the same randomization group ("rdm"). Each group contains 2 questions:
    • the actual question, which is filtered by this condition:
      ((( ! is_empty(counter.NAOK) && (counter.NAOK < 3))))
    • a numeric question that
      • increases "counter" by 1 with this formula:
        counter = sum(counter.NAOK, 1)
      • is also filtered by the same condition:
        ((( ! is_empty(counter.NAOK) && (counter.NAOK < 3))))
      • is hidden via css-class 
        d-none
  • When doing the survey, there is a blank page after the random questions. I am not sure where it comes from and need to disable it. This is where I am glad for any input!
  • Lastly, there is an unrelated question representing the rest of the survey. This includes no logic. It's only included to showcase the empty page before.
Thanks in advance for any help with this!

Cheers,
Nils

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 weeks ago #265854 by tpartner
You cannot use a numeric question to set another question. Do that with (hidden) equation questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 weeks ago #265857 by tpartner
I think, instead of trying to set a question, you would be better off using the Qcode.gseq variable to place relevance on the randomized groups.

manual.limesurvey.org/ExpressionScript_-...#Access_to_variables

 

Sample survey:  

File Attachment:

File Name: limesurvey...1731.lss
File Size:64 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
  • Please Log in to join the conversation.

    • Joffm
    • Joffm's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 month 4 weeks ago - 1 month 4 weeks ago #265859 by Joffm
    Hi,
    if the scenario is really "2 out of 6 questions"
    you can do this (without any ExpressionScript or so)
    by
    1. create two groups  (GA and GB)
    2. create two questions in GA
    3. create four questions in GB
    4. hide GB by setting the  "Bedingung" to 0.
    5. enter the same randomizazion group name in all questions
     

    File Attachment:

    File Name: limesurvey...31_J.lss
    File Size:62 KB


    But if your scenario is "two groups out of six" (each group containing several questions)
    you may (in a - hidden - question of type "short text, "QT") enter a javascript snippet
    1. create aa array of six elements, like [1,2,3,4,5,6]
    2. shuffle the array
    3. Remove all elements except the first two
    4. Show only the groups that match the remaining string
    Display the groups with the "Bedingung"
    Group 1: strpos(QT,"1")>0
    Group 2: strpos(QT,"2")>0
    Group 3: strpos(QT,"3")>0
    ...

    ​​​​​​​Joffm


    BTW: There was a big logical error in your survey.
    The groups have a randomizazion group name, but the questions as well.
    This will result in something that 
    • the first displayed group is - randomly - group 5, but the question in this group is - randomly - question 2
    • the second displayed group is - randomly - group 1, but the question in this group is - randomly - question 4
    Meaning: No relation between groups and questions.
    ​​​​​​​
     

    Volunteers are not paid.
    Not because they are worthless, but because they are priceless
  • Last edit: 1 month 4 weeks ago by Joffm.
    The following user(s) said Thank You: DenisChenu

    Please Log in to join the conversation.

    • tpartner
    • tpartner's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 month 4 weeks ago #265860 by tpartner

    BTW: There was a big logical error in your survey.
    The groups have a randomizazion group name, but the questions as well.
    This will result in something that 
    • the first displayed group is - randomly - group 5, but the question in this group is - randomly - question 2
    • the second displayed group is - randomly - group 1, but the question in this group is - randomly - question 4
    Meaning: No relation between groups and questions. 
    oh, I missed the question randomization group.

    Cheers,
    Tony Partner

    Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

    Please Log in to join the conversation.

    • VHVAllgemeine
    • VHVAllgemeine's Avatar Topic Author
    • Offline
    • New Member
    • New Member
    More
    1 month 3 weeks ago #265864 by VHVAllgemeine
    Replied by VHVAllgemeine on topic Hidden question groups are rendered as blank pages
    Dear Joff and Tony,

    thanks for your help!
    I tried your suggested solutions and all of them work great.

    However, in an attempt to exclude unnecessary complexity I omitted a reason, why I initially tried to use a counter:
    The first question is actually a matrix question that acts as a filter on the pool of the random questions.
    In other words: respondents should be displayed 2 out of up to 6 questions at random. There may be cases in which there is only one question eligible (which should still be displayed) or even none at all.

    I am sorry for omitting this, as the filter & randomization was already working and I was thinking I only needed to remove the blank page.

    I tried to adapt the suggested solutions, but I can't make limesurvey evaluate the eligibilty of the questions before choosing the 2 relevant questions. Instead, it seems to choose 2 of the 6 questions and displays them if they are relevant according to the previous answers. This results in randomly displaying 0, 1 or 2 questions even if there are at least 2 questions that should be relevant.

    Attached, you'll find another test survey, that is based on the solution suggested by Tony. This is my latest attempt in which I moved alle the rdm-questions into a single group and used qseq instead of gseq because I thought it might affect the order of the evaluation of the conditions. This is not the case and the behaviour seems to be identical to a structure with one question per group and gseq. The matrix in the first question (that filters the pool of random questions) is now structurally similar to the actual question I want to ask in the survey.

    Please Log in to join the conversation.

    • VHVAllgemeine
    • VHVAllgemeine's Avatar Topic Author
    • Offline
    • New Member
    • New Member
    More
    1 month 3 weeks ago #265868 by VHVAllgemeine
    Replied by VHVAllgemeine on topic Hidden question groups are rendered as blank pages
    I found a solution in that is based on jelo's post in this older thread.
    A lss-file is attached in case someone else faces the same problem in the future.
    • Q00_SQ001 is a matrix question on the first page, that is later used to filter the random questions.
    • The random questions are all placed into the same group...
    • ... and within the same randomization group.
    • The condition for the random questions checks the relevant row of the initial matrix-question and sums up the relevanceStatus of all the other random questions, excluding itself.
      • For the first random question, the condition looks like this:
        ((Q00_SQ001.NAOK == "AO01" or Q00_SQ001.NAOK == "AO02" or Q00_SQ001.NAOK == "AO03") AND (sum(G01Q03rdm2.relevanceStatus, G01Q03rdm3.relevanceStatus, G01Q03rdm4.relevanceStatus, G01Q03rdm5.relevanceStatus, G01Q03rdm6.relevanceStatus) LT 2))
    Once again, thanks for your help!

    Cheers,
    Nils

    Please Log in to join the conversation.

    • Joffm
    • Joffm's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 month 3 weeks ago #265870 by Joffm
    Two advises:
    1. You should consider to use numerical codes, like 1,2,3,...
    To avoid these monsters
    Q00_SQ001.NAOK == "AO01" or Q00_SQ001.NAOK == "AO02" or Q00_SQ001.NAOK == "AO03"
    Simply:
    Q00_SQ001.NAOK<4

    2. Please, do not try to simplify things that only confuse us.

    Joffm
     

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

    Please Log in to join the conversation.

    Moderators: tpartnerholch

    Lime-years ahead

    Online-surveys for every purse and purpose