Welcome to the LimeSurvey Community Forum

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

Exclusive option in Array (Numbers) with checkboxes

More
2 years 4 months ago #242781 by Episteme Investigación e Intervención Social
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,

I am using an Array (numbers) with checkboxes and it would be perfect to add an exclusive option there. I saw that option in Array, multiple choice, etc; but I would like to have it in Array (numbers). For example, I am trying to have "No response" as exclusive option but I can't use Array type because I would like to have more than one option per column selected, in exception of "No response". See the     file attached.

Would that be possible? 

Thank you for your attention and help.

Best regards,

Aida Longan.

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #242786 by tpartner
See this post - forums.limesurvey.org/index.php/forum/ca...erical-matrix#218665

You will need to modify the script for a single exclusive row.

Change this:

Code:
$('tr.subquestion-list', thisQuestion).slice(-2).find('td.answer-item').addClass('exclusive-item');

To this:

Code:
$('tr.subquestion-list:last', thisQuestion).find('td.answer-item').addClass('exclusive-item');

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 2 years 4 months ago by tpartner.

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #242792 by Episteme Investigación e Intervención Social
Thanks, tpartner for your quick response. Your reply helped a lot. Just one more thing, I would also like to limit the responses to just two columns instead of having the possibility of cheking all boxes in all 4 columns. For example, if the participant responds to the column 1 and 2 (Madre, Padre), he can't respond to the columns 3 and 4 (Madre 2, Padre 2). Or should I open a new topic? Thanks again.
 
Last edit: 2 years 4 months ago by Episteme Investigación e Intervención Social.

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #242799 by Joffm
You may validate.
Something like
sum(if(count(self.sq_X001.NAOK)>0,1,0),if(count(self.sq_X002.NAOK)>0,1,0),if(count(self.sq_X003.NAOK)>0,1,0),if(count(self.sq_X004.NAOK)>0,1,0)) < 3
y-axis coded "Y001", "Y002",...
x-axis coded "X001", "X002",...
 

 

Joffm

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

Please Log in to join the conversation.

More
2 years 4 months ago #242802 by Episteme Investigación e Intervención Social
Thanks for your quick response. I changed the X axis codes like that: 

sum(if(count(self.sq_ma.NAOK)>0,1,0),if(count(self.sq_pa.NAOK)>0,1,0),if(count(self.sq_ma2.NAOK)>0,1,0),if(count(self.sq_pa2.NAOK)>0,1,0)) < 3

where my x-axis where coded as "X001" was "ma", "X002" as "pa", "X003" as "ma2" and "X004" as "pa2".

I add it in the box called: Subquestion Validation Equiation but it doesn't work. Did I miss something?
 

Please Log in to join the conversation.

More
2 years 4 months ago #242804 by Joffm
"ma" and "ma2" is not the best choice.
Why? Because "ma2" also contains "ma" and "count(self.sq_ma.NAOK)" will count "ma" and "ma2".

Please read the manual about the variables ".self" and ".that"
[url] www.limesurvey.org/manual/ExpressionScri....22that.22_variables [/url]

If it still doesn't work, please send the lss export of your survey.

Joffm

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

Please Log in to join the conversation.

More
2 years 4 months ago #242815 by Episteme Investigación e Intervención Social
I still have the same problem, I send you the .lsq format. 
Thank you very much.

File Attachment:

File Name: ArrayNumbe...rmat.lsq
File Size:18.97 KB
 

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #242816 by Joffm
lsg and lsq exports are language sensitive.
To ease our work we therefore always ask for lss.


"language sensitive" means:
You can't import a lsq or lsg export into a survey with a different base language.
So we have to guess the base language of your export, create a survey, create a group to be able to import.your lsq export.
Furthermore these exports don't contain surveywide settings which may be important, too.

Joffm 

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

Please Log in to join the conversation.

More
2 years 4 months ago #242830 by Episteme Investigación e Intervención Social
Okey, makes a lot of sense. Here I attached the .lss format. The problema is with the last question of the first question group. I attached the details:
 
 

File Attachment:

File Name: Evaluacion...ades.lss
File Size:216.36 KB

Please Log in to join the conversation.

More
2 years 4 months ago #242832 by Joffm
This is simply wrong syntax.
At least ot is like
!is_empty(Q1_ma_7) or whatever code you used.

 

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

Please Log in to join the conversation.

More
2 years 4 months ago #242833 by Episteme Investigación e Intervención Social
Hi Joffm,
My question code is: ocuprog
and the subquestion codes are: ma, pa, segm, segp (the 4 columns in the Array, X-Scale).
I'm not sure why do you include the number 7 there:
"!is_empty(Q1_ma_7)".
Thank you!

Please Log in to join the conversation.

More
2 years 4 months ago #242834 by Episteme Investigación e Intervención Social
I changed the code values as you said to make this easier as follows:
Question code as Q1 and subquestions as X01, X02, X03 and X04. And copied your code as your previous reply:
 

It still doesn't work.
I don't know if an HTML code I have might be interfering. I have that to make last subquestion in the Y-axe exclusive as it is "No response".
Thank you again

Please Log in to join the conversation.

More
2 years 4 months ago #242835 by Joffm
Hi, where is the lss export.

And "it doen't work" is not the best description.
What doesn't work?
Can you proceed even if you selected options in three columns.
Why didn't you enter a validation tip?

What I see in your screenshot:
1. You set the question to "mandatory".
You never can fulfill this requirement if you allow maximal 6 answers. It's less than the number of rows.

2. If you set the minimum number of answers to 4, your "wrong" validation of the exclusive row is not necessary.
The respondent can't select more than 2 "None of the above" (because only two columns can be filled)
But he has to select something else (at least in one column) to fulfill the minimum of 4 answers.

3. "+" is an arithmetic operator, not a logical operator. I am sure you do not want to summarize this.
Logical operators are "AND" or "&&".
See the manual [url] www.limesurvey.org/manual/ExpressionScri...ntation/en#Operators [/url]

I'm not sure why do you include the number 7 there:
"!is_empty(Q1_ma_7)".

As I wrote "or whatever code you used.".
In your previous lss I now see that it is "NSNC". So it should be "!is_empty(Q1_NSNC_ma)"

More only after you send the actual lss export.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
2 years 4 months ago #242917 by Episteme Investigación e Intervención Social
Hi Joffm,
What I need is an Array where participants can respond to max. 2 columns out of 4:
- Mother - Father - 2nd Mother -2nd Father
Since people usually just have one or two parents (one father and one mother, two mothers or two fathers). When I said it doesn't work I meant the selection of just two columns, people could select checkboxes in all four columns. 
And we would like to know the ocupation of each one (rows), that ocupation can be one or two checkboxes or even more, that's why I put a max of 6, but I deleted the minimum now as you said. The last row is exclusive between rows because it's "No response" and I put the code tpartner said above in the HTML. 
I send you the .lss
Thank you again.
Best, 
 

File Attachment:

File Name: Evaluacion...es_2.lss
File Size:216.38 KB

Please Log in to join the conversation.

More
2 years 4 months ago #242919 by Joffm
Hi,
1. your question can't be "mandatory" because you do not allow all rows to be filled (maximum 6)




2. Now (not mandatory)
As long as you do not enter a validation tip you will not see anything until you want to proceed.
 
But here the modal appears.


But with a validation tip you immediately see the error message
 

So, I do not see any issue.

Joffm
 

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose