Welcome to the LimeSurvey Community Forum

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

Array filter based on preceding array

  • hanwerts
  • hanwerts's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #142691 by hanwerts
Array filter based on preceding array was created by hanwerts
Attached you find three array questions. Answering the first one now leads to showing the same categories (courses) at the second and third question, regardless of the answers given at the first question.

However, the second and third question should only present the corresponding categories of the first question if the respondent answered NOT “None”.

How can this be programmed in LimeSurvey? Do we need Expression Manager to accomplish this? If so, what is the script? Thank you!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago - 7 years 8 months ago #142698 by Joffm
Replied by Joffm on topic Array filter based on preceding array
Hi, hanwerts,

that's easy.
In the second and third matrix you use relevance:
See screenshot
The relevance is like : mat1_SQ001!="A1" with
"mat1" the questioncode
SQ001 the code of subquestion
A1 the code of answer option.

See example in second and third screenshot.

Best regards
Joffm

P.S. You didn't tell us which LS version you use.
The screenshot looks like 2.05/2.06.
Then it's the same procedure but the screen looks like screenshot 4 (you have to click the "R" to enter the relevance.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 7 years 8 months ago by Joffm. Reason: Ergänzung
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • hanwerts
  • hanwerts's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #142795 by hanwerts
Replied by hanwerts on topic Array filter based on preceding array
Hello Joffm,

Thanks for your reply. Our version of LimeSurvey is 2.05. I don’t see the Relevance button so it looks like your version does not work in our version. It seems that this function is implemented as of version 2.06.

We’ve tried to directly use your Relevance code (of course with our own question and answer codes), but the result is the same. The categories in the first question that are answered “None” still are presented in the following questions. These categories should remain hidden.

Since you stated this to be an easy “issue”, perhaps you could help us out in version 2.05.

Thanks
Regards
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #142804 by tpartner
Replied by tpartner on topic Array filter based on preceding array
In version 2.05, you'll need to insert a hidden multiple choice question to handle the filtering.

Have a look at this post - www.limesurvey.org/forum/can-i-do-this-w...er-javascript#137115

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago - 7 years 8 months ago #142838 by DenisChenu
Replied by DenisChenu on topic Array filter based on preceding array
Yep,

See exemple here too : demonstration.sondages.pro/676785 , survey in french but script an EM is international.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 8 months ago by DenisChenu.
The topic has been locked.
  • hanwerts
  • hanwerts's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #142884 by hanwerts
Replied by hanwerts on topic Array filter based on preceding array
Hi Tony and others,,

Thanks for your reply. It works perfect when I use it in a group, i.e. when these questions are presented on one page.

We would like to use the same procedure in a questionnaire with only one question per page. When I try this with your script, on the next page I only see the question and the label names but not the categories which I answered other than “none” on the previous page . Do you know how to make your script work in a questionnaire with one question per page?

Thanks in advance.

Regards,
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #142926 by tpartner
Replied by tpartner on topic Array filter based on preceding array
My workaround will only work if the hidden question can be placed on the same page as the array. JavaScript can only manipulate elements on the same page.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose