Welcome to the LimeSurvey Community Forum

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

Ranking Question: Hide answer options if blank when piped in from another Questi

  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 months 1 week ago - 2 months 1 week ago #265614 by cheeseburger
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.5.14+240624
Own server  
Survey theme/template: Currently Fruity
==================

Hi Everyone. I have an array question (ArrayQ) with sub questions labeled SQ001, SQ002, etc and answers labeled A001, A002, etc. I then have a question after this array that is of type Ranking. Within the answer options of the ranking question, I have them with labels such as RAO1, RAO2, etc. 

For the values of the RANKING question's ANSWER OPTIONS we are using code to determine the values based on values selected in the preceeding ARRAY question. 

For example: 
{if(ArrayQ_SQ001=='A002',ArrayQ_SQ001.question," ")}

This is successfully working so that if we choose the answer within the array that is the value or A002, it will display the text of the question within our answer option of the ranking question. 

BUT for the other side of the condition, when it does not equal A002, we would prefer to not display a blank " " value within the ranking question's answer option, but would instead like to hide the answer and its surrounding container. 

As of now, our ranking question's answer options will display correct values piped in from the array question but it will also display empty cells when it sets the value to " ". Again, this is a correct behavior based on the code, but is there a way to HIDE the answer option entirely? 

We can do this with JS but for the client's sake, would like to investigate if there is a method to do this directly inside of LS using Expression Manager code. 

Thanks! 

 
Last edit: 2 months 1 week ago by cheeseburger.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 1 week ago - 2 months 1 week ago #265615 by Joffm
Tis is the usual scenario if there is no subquestion relevance in the second question.

Insert a (hidden) multiple question (HM) between  the two questions with the same items.
In an equation preset this.
{HM_1=if(Q1_1==2,"Y","")}
{HM_2=if(Q1_2==2,"Y","")}
...

Then use this hidden multiple as array filter.

Remember to use identical codes.




Better you send the lss export 

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
  • Last edit: 2 months 1 week ago by Joffm.

    Please Log in to join the conversation.

    • cheeseburger
    • cheeseburger's Avatar Topic Author
    • Offline
    • Senior Member
    • Senior Member
    More
    2 months 6 days ago - 1 month 3 weeks ago #265658 by cheeseburger
    Thank you Joffm. This almost makes sense to me. I will continue to attempt to implement what you suggest. Since you suggested that I upload the LSS file, I made a test survey to upload, that represents our scenario. Thank you for any additional help! The test .LSS file should be attached to this message. Thanks again!
    Last edit: 1 month 3 weeks ago by cheeseburger.

    Please Log in to join the conversation.

    • cheeseburger
    • cheeseburger's Avatar Topic Author
    • Offline
    • Senior Member
    • Senior Member
    More
    1 month 3 weeks ago - 1 month 3 weeks ago #265907 by cheeseburger
    Hi again Joffm, I apologize, but after making a solid attempt at understanding and implementing your solution, we have yet to correctly duplicate your suggested steps. I have supplied a sample LSS file (in my other reply before this reply). Would you mind looking at that and/or sending an LSS file with the solution so we could analyze and understand it better? We read through a dozen times and tried various approaches but are not fully understanding what you suggest. Thank you so much for your time! 

    QUICK UPDATE: I am getting close to understanding your suggestion. I was successfully able to set up another test with the following:

    1 - A multiple choice question (MC1)
    2 - A Ranking Question and I used its sidebar for the ARRAY FILTER and I used the value "MC1" so it can reference the multiple choice question. I matched the answers and the values in the answers in both the Multiple Choice question and the Ranking Question. It successfully displayed the items in the ranking question based on what I chose in the MC. 

    NOW my next step is to use this MC as a hidden question and I am ATTEMPTING to set its checked values based on an Array Question

    If the array (Q5) includes foods such as pizza (SQ1), sushi(SQ2), and burgers(SQ3) and the answer options include: I like(A1), I love(A2), I don't like(A3)

    Pizza  - I like | I love | I don't like
    Sushi  - I like | I love | I don't like
    Burgers  - I like | I love | I don't like

    I am trying to use an equation question to look at each row (food) and for any given row that the user chose "I love"(A2), I am attempting to check in the related box in the multiple choice. 

    Example: { MC1_SQ1  = if( q5_SQ1.NAOK  == "A2", "Y", "")}

    I cannot get this to check the box in the MC if it is in a condition. But I can get to check the box if I simply use { MC1_SQ1 ="Y"} and when I test the value of {q5_SQ1} it does read as "A2". I am not sure why it is not working within a condition though. I have placed the equation question in many locations in the event it was an order of execution issue. 

    The order of my questions are as follows: 
    1. Array with the food 
    2. The multiple choice Question with the options Pizza, Sushi, Burgers (each with a checkbox)
    3. The ranking order question
    4. The equation question with the code to listen for the value in the array, then to check off the boxes in the multiple choice question. I have placed this question above and below all other questions. 

    Thanks for any help! 
     
    Last edit: 1 month 3 weeks ago by cheeseburger.

    Please Log in to join the conversation.

    • Joffm
    • Joffm's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 month 3 weeks ago #265913 by Joffm
    Hi,
    what can I reply, if you do not show what exactly you did?
    lss Export, please.

    Joffm

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

    Please Log in to join the conversation.

    • cheeseburger
    • cheeseburger's Avatar Topic Author
    • Offline
    • Senior Member
    • Senior Member
    More
    1 month 3 weeks ago #265938 by cheeseburger
    You are correct. Here is the LSS file. The question text includes some description about what each is attempting to do. Thank you for your help!
     

    File Attachment:

    File Name: limesurvey...7-16.lss
    File Size:44 KB
  • Please Log in to join the conversation.

    • Joffm
    • Joffm's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 month 3 weeks ago #265940 by Joffm
    Hi,
    1. You'd insert all needed equations into EQ1
    {q3_SQ1=if(q5_SQ1.NAOK=="A1","Y","")}
    {q3_SQ2=if(q5_SQ2.NAOK=="A1","Y","")}
    {q3_SQ3=if(q5_SQ3.NAOK=="A1","Y","")}

    2. And it doesn't work in the same group (you might have missed the small line between the two questions in my screenshots).
     
     
     

    Joffm

    Volunteers are not paid.
    Not because they are worthless, but because they are priceless
  • Please Log in to join the conversation.

    • cheeseburger
    • cheeseburger's Avatar Topic Author
    • Offline
    • Senior Member
    • Senior Member
    More
    1 month 3 weeks ago #265942 by cheeseburger
    Ahhhh yes - very nice catch! The biggest issue was that I was not splitting them across multiple pages. I've encountered this requirement in a very different scenario in past years. Thank you so much. This is working exactly as needed (as long as the client is OK with working across multiple pages). Thank you! 

    Please Log in to join the conversation.

    Moderators: tpartnerholch

    Lime-years ahead

    Online-surveys for every purse and purpose