Welcome to the LimeSurvey Community Forum

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

Exclusive option prevents me from filling in question stem

  • kgrewal6
  • kgrewal6's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #232670 by kgrewal6
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.24.2
Own server or LimeSurvey hosting: University-affiliated server (cannot edit theme or use scripts)
Survey theme/template: University default
==================
Hi, I am currently creating a survey as part of my research, however, the exclusive option is preventing my code from working. 

The University does not give access for me to use CSS or Javascript scripts, so I'm restricted to using only coding within the question stem itself.

My goal with this question (GEW2) is to have participants select as many options as they would like, and their responses will fill in the blank within the question stem (e.g., "When I am upset, I, typically, _____" and their responses would create a list). The code I have been using so far works great.... until I set an exclusive option for an option that would contradict the rest (e.g., "do nothing"). When this option is selected, I want the question stem to act as it does with the other options (e.g.,  "When I am upset, I, typically, do nothing.") but once I set it as exclusive, it stops working. I noticed that when I set it to exclusive and the option is selected, part of the question stem seems to disappear (specifically, it seems to default to "__." which is no where in the question stem or coding).

I'm wondering if anyone knows a way to call upon response to the exclusive option?

The code I have been using is:
{if(count(that.GEW2.NAOK)>0,join(if(!is_empty(GEW2_other),join(", _",GEW2_other)),if(!is_empty(GEW2_A1),join(", _", GEW2_A1.shown)),if(!is_empty(GEW2_A2),join(", _",GEW2_A2.shown)),if(!is_empty(GEW2_A3),join(", _", GEW2_A3.shown)),if(!is_empty(GEW2_A4),join(", _",GEW2_A4.shown)),if(!is_empty(GEW2_A5),join(", _",GEW2_A5.shown)),if(!is_empty(GEW2_A6),join(", _",GEW2_A6.shown)),if(!is_empty(GEW2_A7),join(", _",GEW2_A7.shown)),if(!is_empty(GEW2_A9),join(", _",GEW2_A9.shown)),if(!is_empty(GEW2_A10),join(", _",GEW2_A10.shown)),if(!is_empty(GEW2_A11),join(", _",GEW2_A11.shown)),if(!is_empty(GEW2_A12),join(", _",GEW2_A12.shown)),if(!is_empty(GEW2_A8),join(", _",GEW2_A8.shown))),", ______")}.
(note that the bolding and underlines are to indicate to the participant that those are the parts of the sentence that the participant has filled in with their selection(s))

To summarize what it does, it checks to see if any responses have been selected for the question, and if they have, it goes through each response option and determines whether it was selected or not. If it has been, it adds a comma followed by an underline and the response option so that a list is created. However, for some reason, once A8 is set to my exclusive option, it fills in the response as "__.". I do not know where it gets that from as it appears no where in the question stem or in the code, so I'm wondering if it's some type of bug. 

Any help is greatly appreciated!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #232672 by Joffm
Please, provide a lss export of this question.
Copy the survey, remove all other questions and export this as lss.

I do not see your issue.
The "join" function doesn't display anything if the exclusive option is selected.
But we do not know each detail of your design.  Therefore lss export.


 


Joffm

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

Please Log in to join the conversation.

  • kgrewal6
  • kgrewal6's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago - 2 years 3 months ago #232673 by kgrewal6
Hi Joffm, I've attached the lss file. I'm not familiar with the list function you have demonstrated in the screenshots, but that is ideally what I am going for with my question. I would like the text for the exclusive option to appear within the question stem.

File Attachment:

File Name: limesurvey...2392.lss
File Size:122 KB


Edit: Apologies, I accidentally set both A7 and A8 as exclusive options in the .lss file while troubleshooting. Only A8 should be exclusive.
Last edit: 2 years 3 months ago by kgrewal6.

Please Log in to join the conversation.

  • kgrewal6
  • kgrewal6's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #232674 by kgrewal6
I think I managed to solve my problem (thanks to Joffm's suggestion of using the list function and my friend who suggested separate if statements). It seems that LimeSurvey considers exclusive options to neither answer or not answer the question, meaning that any if statements regarding whether the question was answered would be ignored. I'm not sure whether this is a bug, or intentional. (I also had to create a separate if statement for when there was no response selected as LimeSurvey was causing it to be appended to the end of the list).

To fix this, I created separate if statements, one specifically for whether that specific subquestion was selected, and this seems to have resolved my issue.

The code I used is:
{if(count(that.GEW2.NAOK) >0,list(if(!is_empty(GEW2_other),GEW2_other),if(!is_empty(GEW2_A1),GEW2_A1.shown),if(!is_empty(GEW2_A2),GEW2_A2.shown),if(!is_empty(GEW2_A3),GEW2_A3.shown),if(!is_empty(GEW2_A4),GEW2_A4.shown),if(!is_empty(GEW2_A5),GEW2_A5.shown),if(!is_empty(GEW2_A6),GEW2_A6.shown),if(!is_empty(GEW2_A7),GEW2_A7.shown),if(!is_empty(GEW2_A9),GEW2_A9.shown),if(!is_empty(GEW2_A10),GEW2_A10.shown),if(!is_empty(GEW2_A11),GEW2_A11.shown),if(!is_empty(GEW2_A12),GEW2_A12.shown)))}{if(!is_empty(GEW2_A8),join(GEW2_A8.shown))}{if(count(that.GEW2.NAOK)==0,join("_____"))}.

Thank you so much for the help!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #232675 by Joffm
If you show it in the same question
this is sufficient:
{if(count(self)>0,list(self.shown),"________")}{if(!is_empty(GEW2_A8),GEW2_A8.shown)}

1. the "list" function only displays selected elements; so your "!is_empty" is not necessary.
2. If there is only one element, what do you want to join?
{if(!is_empty(GEW2_A8),join(GEW2_A8.shown))}





This was done in 3.27.33

Joffm
 

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #232676 by Joffm
Small correction to handle the "Other" correctly:
Assuming that your subquestion codes start with "A"
{if(count(self)>0,list(self.sq_A.shown,GEW2_other),"________")}{if(!is_empty(GEW2_A8),GEW2_A8.shown)}

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