Welcome to the LimeSurvey Community Forum

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

Array Filter Exclusion for two questions without the exact same answer options

  • JasonZA
  • JasonZA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 5 days ago #256965 by JasonZA
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.36+230830
Own server or LimeSurvey hosting: Own server
Survey theme/template: 
==================
Good day. I have a list (radio) question where the respondent can select the biggest challenge and the next question, which is also a list (radio) question where the respondent can select the biggest strength. I have added the table below for reference. What I require is an Array filter exclusion for only answers shown in the biggest challenge question and the biggest strength question that are the same. The answer options are not the same for both questions but there are some, which I'd like an array filter exclusion added to. Is this possible. Any assistance will be much appreciated.

Kind Regards,
Jason

Please Log in to join the conversation.

  • JasonZA
  • JasonZA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 5 days ago #256975 by JasonZA
I found the following script that applies to Multiple Choice questions and tried to implement this but it would not work. I'm assuming this is due to it being made for a multiple choice question. Please assist if you are able to.

<script type="text/javascript" charset="utf-8">        
 
    $(document).ready(function() {
 
        // Remove rows
        $('#javatbd{SGQ}1').remove();
        $('#javatbd{SGQ}8').remove();
        $('#javatbd{SGQ}14').remove();

        // Fix up the row classes
        var rowClass = 1;
        $('#question{QID} table.subquestions-list tbody tr').each(function(i) {
            if($(this).hasClass('sub-header-row')) {
                rowClass = 1
            }
            else {
                rowClass++;
                $(this).removeClass('array1 array2')
                if(rowClass % 2 == 0) {
                    $(this).addClass('array2');
                }
                else {
                    $(this).addClass('array1');
                }
            }
        });
    });
</script>

Kind Regards,
Jason

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 4 days ago #256980 by Joffm
Hi

which is also a list (radio) question where the respondent can select the biggest strength. I have added the table below for reference. What I require is an Array filter exclusion for only answers shown in the biggest challenge question and the biggest strength question that are the same.

Sorry, I do not understand.
You have two list(radio) questions (Q1 and Q2)

And now you want to display in Q3 what?
All answer options that are in Q1 as well as in Q2, but are not selected in Q1 or Q2?

This is my understanding of it.
Well, this is the same approach I showed in your last question.
You only have to adapt the equation.
Like 
{HM3_2=if(Q1==2 or Q2==2,"","Y")}
{HM3_4=if(Q1==4 or Q2==4,"","Y")}
...
Again the array filter of Q3 set on HM.
Of course you can do it viceversa and set the array exclusion filter.





What is missing in this my example is the handling of "other" and "none"

Better you send the lss export.

Joffm

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

Please Log in to join the conversation.

  • JasonZA
  • JasonZA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 4 days ago #256982 by JasonZA
Hi @Joffm. Thanks again for your assistance. This is the last query on this questionnaire. The client wants to know the biggest challenge and then also the biggest strength of their brand. If something in Q15 is not regarded the biggest challenge, it may in fact be their biggest strength but not all challenges can be regarded as strengths, so that is why the two questions have similar answer options but a few differences.

If an answer option in Q15 is selected, it must not be shown in Q16 (Array Exclusion) but I need to hide specific answer options in Q15 that are not applicable to Q15 and some in Q16 that are not applicable in Q16.

i.e. hide answer option CC, FF, GG and NN in Q15 and hide answer option AA, HH and OO in Q16.

For some odd reason when I try adding Q15 as the Array filter exclusion for Q16, it throws some PHP error but my main concern at present is hiding the answer options for Q15 and Q16.

I have attached the lss file.

Kind Regards,
Jason

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 4 days ago #256989 by Joffm

If an answer option in Q15 is selected, it must not be shown in Q16 (Array Exclusion)

Okay.

but I need to hide specific answer options in Q15 that are not applicable to Q15 and some in Q16 that are not applicable in Q16.

So, why do you display these answer options?

It is the same as before.
Set the hidden multiple like
{HM_2=if(Q15==2,"Y","")}
{HM_3=if(Q15==3,"Y","")}
  as Q15 never will be equal 3, you could remove this.
{HM_4=if(Q15==4,"Y","")}
{HM_5=if(Q15==5,"Y","")}

​​​​​​​{HM_7=if(Q15==7,"Y","")} as Q15 never will be equal 7, you could remove this.
​​​​​​​{HM_9=if(Q15==9,"Y","")}
...

And use it as array exclusion filter.

Joffm

For some odd reason when I try adding Q15 as the Array filter exclusion for Q16, it throws some PHP error but my main concern at present is hiding the answer options for Q15 and Q16.

Read the manual (again):
[url] manual.limesurvey.org/Question_type_-_Ar...r_.28array_filter.29 [/url]
 

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

Please Log in to join the conversation.

  • JasonZA
  • JasonZA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 4 days ago #256991 by JasonZA
Thanks a lot, @Joffm. I really appreciate it.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose