Welcome to the LimeSurvey Community Forum

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

Array (number) display as checkbox: validation/exclusive columns

More
3 weeks 9 hours ago #273095 by Nozigan
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: umontreal
Survey theme/template:
==================
Hi,

I need some help understand how validation works and I don't/can't hace admin right, so any script solution won't work.
So here is my problem. I hace an array (number) displayed as checkboxees, and I would like that users can't have chaeck a specific column with anu other (so exclusive behaviour for this particular column). As I can't use a script, I think the best practice would be to use validation. However, I have tried numerus attempts (using count, sums etc.) and none of them seems to work. Do you have any sugestions on what I should enter in the validation field to prevent users to both check that specific column with any of the other 3?

Please Log in to join the conversation.

More
2 weeks 6 days ago #273100 by Joffm
Hi,
a validation equation is a logical term that has to be TRUE to be able to proceed.
Or: Here you enter the condition  that has to be met.

In your case:
Either this specific checkbox is empty or (it is not empty and the count of selected checkboxes is equal 1)

Generally:
You'd better sent the lss export of the relevant questions with your attempts so far.

This way we can show your mistakes and you learn more than just copy/past e solution.

Joffm
 

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

Please Log in to join the conversation.

More
2 weeks 5 days ago - 2 weeks 5 days ago #273134 by Nozigan
 

File Attachment:

File Name: limesurvey...0959.lsq
File Size:57.54 KB
 

Attachment not found

Thanks for your answer. I think I followed your advice, but it still doesn't work. So I obviously missed something. This is an array with multiple subquestions, but I am only added the condition to validate the first few row/subquestions. Here is what I entered:

(is_empty(C12T_C12a_N) or ( ! is_empty(C12T_C12a_N) and count(C12T_C12a_Om, C12T_C12a_Oi, C12T_C12a_A) > 0)) or (is_empty(C12T_C12b_N) or ( ! is_empty(C12T_C12b_N)and count(C12T_C12b_Om, C12T_C12b_Oi, C12T_C12b_A) > 0)) or (is_empty(C12T_C12c_N) or ( ! is_empty(C12T_C12c_N) and count(C12T_C12c_Om, C12T_C12c_Oi, C12T_C12c_A) > 0))

where C12T is the question ID, C12a, C12b, C12c... the subquestions (Y-scale) and Om, Oi, N and A are the options (X-scale).
I am not sure how to produce a lss file, but I was able to export the question as lsq (attached). I hope this helps.
Last edit: 2 weeks 5 days ago by Nozigan. Reason: The file was missing

Please Log in to join the conversation.

More
2 weeks 4 days ago - 2 weeks 4 days ago #273138 by Joffm
Hi,
1. you export the lss file here
 

2. There are several mistakes in your equation
a. If you have a look at your equation of one row, it says
(is_empty(C12T_C12a_N) or ( ! is_empty(C12T_C12a_N) and count(C12T_C12a_Om, C12T_C12a_Oi, C12T_C12a_A) > 0)
Meaning: Either C12T_C12a_N is empty OR (C12T_C12a_N is not empty and the number of all OTHER checked checkboxes is greater than 0.
But this is just the opposite of your goal.
If C12T_C12a_N is not empty ALL OTHER checkboxes have to be empty -> their count has to be 0 (or: the total count has to be 1 - only the exclusive checkbox is checked)
I used the second option, because here you can easily use the variable "self", especially with your way to code the subquestions.

b. This equation has to be TRUE for each row.
(is_empty(C12T_C12a_N) or ( ! is_empty(C12T_C12a_N) and count(C12T_C12a_Om, C12T_C12a_Oi, C12T_C12a_A) > 0)) 
or 
(is_empty(C12T_C12b_N) or ( ! is_empty(C12T_C12b_N)and count(C12T_C12b_Om, C12T_C12b_Oi, C12T_C12b_A) > 0)) 
or 
(is_empty(C12T_C12c_N) or ( ! is_empty(C12T_C12c_N) and count(C12T_C12c_Om, C12T_C12c_Oi, C12T_C12c_A) > 0))

You use the OR operator.
Hm, an OR conjunction is TRUE when one part of it is TRUE. This is not what you want to happen.
ALL parts have to be TRUE that the entire equation is TRUE.
Here you have to use the AND operator
An AND conjunction is TRUE when all parts of it are TRUE.

Please, correct this and if there are more questions send the lss export.

Joffm

Reasons, why we ask for lss exports only.
lsq and lsg exports are language sensitive. You can only import tinto a survey with the same base language.
So, to do this, we have to guess the base language, create a survey, create a group to be able to import the lsq. And if we guessed the language wrong, bad luck.
No, please ease the life of us volunteers and send only lss. 
Copy the survey, remove everything not related to your problem and export the rest.

Furthermore these lsq or lsg exports don't contain the survey wide settings thayt sometimes are important, too.

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

Please Log in to join the conversation.

More
2 weeks 4 days ago #273143 by Nozigan
 

File Attachment:

File Name: limesurvey...32-2.lss
File Size:556.68 KB

File Attachment:

File Name: limesurvey...32-2.lss
File Size:556.68 KB
Thank you for your answers and the information on how to export as lss (which I did). I also feel a little stupid with the extra space and all (I tried so many things that I probably ended up messing up). That being said, I tried to correct the mistakes you pointed (I didn't use "self" as I am unsure of the way it would work in this context). Unfortunately, it still seems to fail. I attach the lss file of the survey (the question is the last one in a group called "Testing" 

Please Log in to join the conversation.

More
2 weeks 4 days ago #273144 by Joffm
Hi,
Now I do not see any issue.
The validation is fine
 

Though - as I wrote before - it's shorter with the variable "this"
(is_empty(C12T_a_N) or ( !is_empty(C12T_a_N) and count(self.sq_a) == 1)) and 
(is_empty(C12T_b_N) or ( !is_empty(C12T_b_N) and count(self.sq_b) == 1)) and 
(is_empty(C12T_c_N) or ( !is_empty(C12T_c_N) and count(self.sq_c) == 1)) 

 

But what is your idea abut this?
 
You set the minimum number of answers to 1, and the maximum number of answers to 0.
How can this be fulfilled?

If you do not know how expressions work, a. read the manual and b. put them into the question text (with the curly brackets).
Like
 
Then you see in this case
 
So "self" expands the question to all subquestions (with sq = subquestion you can limit to certain requirements)

 I didn't look at the rest, but your way to code is in my opinion "improvable".
And maybe it's better to include these explanation of "others" C12 into the question itself, or at least use a question of type "multiple short text".
If I have time I will show this unclusion.

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