Welcome to the LimeSurvey Community Forum

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

Use comma to seperate if two or more INSERTANS are selected

  • SurveyDesigner
  • SurveyDesigner's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago - 5 years 5 months ago #175863 by SurveyDesigner
Hi there,

I am trying to wrap my head around tailoring questions and need some help.

I used the placeholder fields to display selected answers from a previous question:

Code:
As a {INSERTANS:627324X135X1044SQ001}​​​​​​​, {INSERTANS:627324X135X1044SQ002}​​​​​​​, {627324X135X1044other}​​​​​​​  I want to learn …

Now I want the commas only to appear if more than one answer has been selected. Can you tell me how I achieve that?

Thanks!
Last edit: 5 years 5 months ago by SurveyDesigner.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago - 5 years 5 months ago #175867 by tpartner
For the first comma (replace "Q1" with the appropriate question code):

Code:
{if(count(Q1_SQ001, Q1_SQ001, Q1_other) > 1, ', ', '')}

For the second comma:

Code:
{if(count(Q1_SQ001, Q1_SQ001, Q1_other) > 2, ', ', '')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 5 months ago by tpartner.
The topic has been locked.
  • SurveyDesigner
  • SurveyDesigner's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175924 by SurveyDesigner
Hi,


unfortunately, the comma is displayed above the line where it should be in a grey box (see picture).




Also, I was wondering if there is a way to add the other field as a condition for a question since it does not show up in the condition editor…


Thanks!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #175926 by tpartner
Can you attach a survey export (.lss file) containing only the pertinent questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • SurveyDesigner
  • SurveyDesigner's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175927 by SurveyDesigner
I just noticed that the strange display of the comma happened because I did not edit the text in source mode which is why there where some HTML tags added. I will try it now using the source mode.

Do you know how I can add an "other" answer as a condition?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #175929 by tpartner
Can you attach a survey export (.lss file) containing only the pertinent questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • SurveyDesigner
  • SurveyDesigner's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175930 by SurveyDesigner
Unfortunately not because the questionnaire contains personal data from employees in some of the questions.
The topic has been locked.
  • SurveyDesigner
  • SurveyDesigner's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #175931 by SurveyDesigner
This is how the set conditions editor looks on my survey. Here I can select all the previously asked questions as a condition for this question to show up. But I need it to show up also if a participant selected "other" in a previous question.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose