Prefill multiple choice question from multiple choice array

More
1 month 3 weeks ago - 1 month 3 weeks ago #158130 by socius
socius created the topic: Prefill multiple choice question from multiple choice array
Dear all,

I fear that this question - or a similar one - was asked before, but I somehow cannot get an answer in the forum and the manual. I use LS 2.6.4-lts.

The short story is: I have a multiple choice array and want to use the answers of the subquestions for array filtering.

The longer story: As a starting point I have a array (numeric) question in checkbox-0/1 mode with 10 rows (for a number of n activities respondents can engage in) and 6 columns (for 6 different groups of people that the respondent engages in the specific activities together). In short, I have a 10x6 array with checkboxes - let's call this question q1, with q1_1_1 to q_10_6.

Now i want to ask further questions for all the combinations in this array that are ticked, e.g. the combination of activity and group, e.g. engagement in activity 1 with group 1, etc. For this reason I would like to transfer/transform the answers from the 10x6 array into a multiple choice variable with 10x6=60 possible rows. This prefilled multiple choice question should be utilised as an array filter for the subsequent questions on the ticked combinations.

Now my question is: do I need Javascript for that prefilling? Reading the manual ( manual.limesurvey.org/Expression_Manager..._Assignment_Operator ) I get the impression that I could achieve this with the Expression Manager alone, where I first create the 60 row multiple choice question (q2_1 to q2_60) and then assign values to the answers of these subquestions with a hidden equation-type question and some code like:
{q2_1=if(q1_1_1==1,"Y","N")}
{q2_2=if(q1_1_2==1,"Y","N")}
{q2_3=if(q1_1_3==1,"Y","N")}
{q2_4=if(q1_1_4==1,"Y","N")}
...
{q2_60=if(q1_10_6==1,"Y","N")}

Finally q2, this prefilled multiple choice question, should then serve as array filter for the following questions.

I tried this, but it didn't work out. Do you have an answer to this? Is it possible w/o Javascript as I have the impression from the manual? Or do we need Javascript here (and how about would that work?).


Thanks a lot for your time and help!
Best, G
Last Edit: 1 month 3 weeks ago by socius. Reason: Changed symbol to "?"

Please Log in to join the conversation.

More
1 month 3 weeks ago #158135 by DenisChenu
DenisChenu replied the topic: Prefill multiple choice question from multiple choice array
With checkbox : Y is for yes but no is '' (empty). And array_filter is done for empty

{q2_1=if(q1_1_1==1,"Y","")} must work

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 .
The following user(s) said Thank You: socius

Please Log in to join the conversation.

More
1 month 3 weeks ago #158140 by socius
socius replied the topic: Prefill multiple choice question from multiple choice array
Hi and thanks again :-) now it works!

But: is it true, that it only works this way (creating filter variable, assign values via EM, use filter variable) if the filter variable (in this case q2) is created on an earlier page than the questions to filter? (In my example here this seems the case...) If yes: I guess the realtime solution needs javascript, right?

Please Log in to join the conversation.

More
1 month 3 weeks ago #158146 by DenisChenu
DenisChenu replied the topic: Prefill multiple choice question from multiple choice array
Yes need javascript. See demonstration.sondages.pro/676785 for a pre "relevance on subquestions"

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 .
The following user(s) said Thank You: socius

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now