- Posts: 27
- Karma: 1
- Thank you received: 1
array filter for array values
Example:
question X - rate these things from 1 to 5
blablabla1 1 2 3 4 5
blablabla2 1 2 3 4 5
blablabla3 1 2 3 4 5
blablabla4 1 2 3 4 5
blablabla5 1 2 3 4 5
then question Y - which from the things is blablablablablabla?
Question Y must be an multiple choice question where only the things from question X are shown that are rated 4 or 5.
Is this possible?
Please Log in or Create an account to join the conversation.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
- Posts: 10505
- Karma: 408
- Thank you received: 1863
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Please Log in or Create an account to join the conversation.
One another thing is that I'm using online Surveylime and haven't access to the server in order to change configuration to run Javascript.
Please Log in or Create an account to join the conversation.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
- Posts: 10505
- Karma: 408
- Thank you received: 1863
demonstration.sondages.pro/upload/survey...y_filtrecomplexe.lss
You can look at Survey Logic file
And in LimeSurvey Professional (previously LimeService) : you can use javascript in your question text. Look at the workaround fr a howto
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Please Log in or Create an account to join the conversation.
Thank you for your answer. My problem now is that I can't run Javascript.
Every website that I found say that I need go to set “Global settings -> Security -> Filter HTML for XSS” to “No”, but I don't have the privilegies to do this.
I tried what is in this page: manual.limesurvey.org/Workarounds:_Manip....29_in_LimeSurvey.3F but the test alert didn't work.
There is any solution?
Please Log in or Create an account to join the conversation.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
- Posts: 10505
- Karma: 408
- Thank you received: 1863
Each question must be in sperate page, see the second system:
- first page : filter + Equation questioin type to SET the filter value (this 2 question can be in the same group than the first question and can be hidden)
- seocnd page : the array filtered.
See the second solution in lss file provided.
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I have the same question, but as I don't speak French (well enough) I don't understand the explanation provided in the example (demonstration.sondages.pro/676785).
Somewhat like the OP, I have
- two (not one) array questions on page 1 (same answer categories, sub-question code continues counting)
- a multiple choice question on page 6 (same sub-question codes & names as the two array questions)
- filtering of the multiple choice question works properly based on the array questions (only shows subquestions which have been answered)
But how can the MC question be filtered on sub-questions marked "Sans réponse" (or 'never used' in my case)?
Trying to read French, I think I need to add javascript to my MC question to filter? Or should I add to my two array questions?
Please Log in or Create an account to join the conversation.
You can use javascript and store variables in an array, and to assemble the values you can use expressions, you can also upload your .lss file to better understand the problem.
<script>
$(document).ready(function() {
var sid = '{SID+'X'+GID+'X'+QID}';
var arreglo = new Array();
//conditions array using expresion
arreglo[0] = {if((PA_1_P1.NAOK == 1) or (PA_1_P2.NAOK == 1),0,1)};
arreglo[1] = {if((PA_2_P1.NAOK == 1) or (PA_2_P2.NAOK == 1),0,2)};
arreglo[2] = {if((PA_3_P1.NAOK == 1) or (PA_3_P2.NAOK == 1),0,3)};
arreglo[3] = {if((PA_4_P1.NAOK == 1) or (PA_4_P2.NAOK == 1),0,4)};
arreglo[4] = {if((PA_5_P1.NAOK == 1) or (PA_5_P2.NAOK == 1),0,5)};
arreglo[5] = {if((PA_6_P1.NAOK == 1) or (PA_6_P2.NAOK == 1),0,6)};
arreglo[6] = {if((PA_7_P1.NAOK == 1) or (PA_7_P2.NAOK == 1),0,7)};
arreglo[7] = {if((PA_8_P1.NAOK == 1) or (PA_8_P2.NAOK == 1),0,8)};
arreglo[8] = {if((PA_9_P1.NAOK == 1) or (PA_9_P2.NAOK == 1),0,9)};
arreglo[9] = {if((PA_10_P1.NAOK == 1) or (PA_10_P2.NAOK == 1),0,10)};
$(arreglo).each(function(index, el) {
if(el == 0)
{
el = "";
}
else{
el = el;
$("#javatbd"+sid+el).hide();
$("input[name="+sid+el+"]").val('9999');
$("input[name="+sid+el+"]").attr('checked',true);
}
});
});
</script>
Please Log in or Create an account to join the conversation.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in or Create an account to join the conversation.
Wasn't sure where the scripts should be placed, but now I know the Expression Manager is possible I'd rather use that

@tpartner, that's what I suspected and so I tried:
- SITU1PLATWHAT_1 (sub question of the multiple choice) with Relevance Equation: if(MEDGEBRTRAD_1 != "Nooit") or if(MEDGEBRTRAD_1 != 1)
- where MEDGEBRTRAD_1 is a subquestion of an array question where Nooit is the answer text and 1 the answer code
I guess I'm doing something wrong here, but don't know what

Attached you find my survey, but don't know how useful it is since all the questions are in Dutch and there's quite a few questions.
Please Log in or Create an account to join the conversation.
I guess the same can be done via regexMatch(pattern,input)?
Please Log in or Create an account to join the conversation.
MEDGEBRTRAD_1 != 1
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in or Create an account to join the conversation.

Thanks for the explanation!
Please Log in or Create an account to join the conversation.