Welcome to the LimeSurvey Community Forum

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

Adding "Other:" option to array

More
11 months 4 weeks ago #255743 by bellagambad
Replied by bellagambad on topic Adding "Other:" option to array
Thank you very much Joffm this is fantastic !
You're right, by filled I meant that a new patient id was reported. Checking a box in 1st or 2nd column is not necessary.
I imported your .lss and it works fine until the loop, so I have a total of 4 "other" options. I am not sure I understood your point concerning the coding of the axis, is it necessary to implement the loop ? Or is it just a best-practice ?
Thank you !
David

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 4 weeks ago - 11 months 4 weeks ago #255748 by Joffm
Replied by Joffm on topic Adding "Other:" option to array

Checking a box in 1st or 2nd column is not necessary.

Fine, adapt the subquestion relevance.

and it works fine until the loop

As the loop is part of the script it works or it does not.
What is your problem?

is it necessary to implement the loop

If you compare the two scripts you will see
  • in the first script there is only one "other" inserted and there is only one line to do this.
  • in the second script there you insert several "others" . Without a loop you have to insert one by one and always have to adapt the script if the number of "others" changes With the loop you are independent of this number.
It is like writing 100 times. You can do it like this
"This is row 1"
"This is row 2"
"This is row 3"
...
"This is row 99"
"This is row 100"
​​​​​​​ 
But you can use a loop like
for (x==1; x<101;x++) {
  write("This is row ".x);
}

I am not sure I understood your point concerning the coding of the axis

As you see in the subquestion relevance I used the variable "self"
Read the manual about these variables!
[url] www.limesurvey.org/manual/ExpressionScri....22that.22_variables [/url]
Meaning: with an "intelligent" coding you can shorten many equation.
In this case you'd have to write
count(G01Q03_SQ006_SQ001,G01Q03_SQ006_SQ002,G01Q03_SQ006_SQ003) 
with "better" coding
count(self.sq_Y006_X)

Further questions?
Send the lss export.

Joffm
 

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

Please Log in to join the conversation.

More
11 months 4 weeks ago #255769 by bellagambad
Replied by bellagambad on topic Adding "Other:" option to array
Thank you for your detailed answer Joffm. Sorry for the confusion, I thought there was a loop that made the number of "other" options infinite. Your explanation and a deeper look in the script you provided helped me understand what was the loop you were talking about in your previous post. Thank you for the manual reference, I'll need to learn that indeed.
Best regards,
David

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 4 weeks ago #255789 by holch
Replied by holch on topic Adding "Other:" option to array

I thought there was a loop that made the number of "other" options infinite.


There is no loop feature in Limesurvey.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

More
11 months 4 weeks ago #255795 by bellagambad
Replied by bellagambad on topic Adding "Other:" option to array
Ok, thank you for the clarification holch !
@Joffm : as I mentioned in a previous post, checking a box in 1st or 2nd column is not necessary. So I adapted the sq relevance like that : 
before the modification : !is_empty(G01Q02) and count(self.sq_SQ006_X)>=0
now : !is_empty(G01Q02) and I did the same for the following sub-questions.
Something seems to be wrong, as I only have the first "other" option showing and the following are not showing even if I complete the first short thext question. Any idea ? Please find the .lss attached if necessary.
Thank you in advance,
David
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 3 weeks ago #255812 by Joffm
Replied by Joffm on topic Adding "Other:" option to array
You can't remove this
and count(self.sq_SQ006_X)>=0

if it is possible to leave all checkboxes empty, add an option "None of these"
 

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

Please Log in to join the conversation.

More
11 months 3 weeks ago #255845 by bellagambad
Replied by bellagambad on topic Adding "Other:" option to array
Thank you Joffm, I'll try to make it work with your cue.

Please Log in to join the conversation.

  • dangerdangerhighvoltage
  • dangerdangerhighvoltage's Avatar
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago - 2 months 2 weeks ago #268010 by dangerdangerhighvoltage
Replied by dangerdangerhighvoltage on topic Adding "Other:" option to array
Is a similar solution possible if the survey is set to display question by question? Or am i out of luck?

I hope thread necromancy isn't frowned upon here.

Edit: Nevermind: I finally found a relevant thread and the only solution it seems.

survey-consulting.com/product/array-with...t-limesurvey-plugin/
Last edit: 2 months 2 weeks ago by dangerdangerhighvoltage.

Please Log in to join the conversation.

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #268011 by Mazi
Replied by Mazi on topic Adding "Other:" option to array

Is a similar solution possible if the survey is set to display question by question? Or am i out of luck?


 
Since only one question element get loaded at question by question mode, this can not work.

Best regards/Beste Grüße,
Dr. Marcel Minke
The following user(s) said Thank You: dangerdangerhighvoltage

Please Log in to join the conversation.

  • dangerdangerhighvoltage
  • dangerdangerhighvoltage's Avatar
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago #268012 by dangerdangerhighvoltage
Replied by dangerdangerhighvoltage on topic Adding "Other:" option to array
Yeah, i just noticed after buying the plugin. RIP ☠

Guess i need to make 50 seperate groups so that those 2 questions can be in the same group.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #268013 by Joffm
Replied by Joffm on topic Adding "Other:" option to array

Is a similar solution possible if the survey is set to display question by question?

As you see in the samples you need atleast two questions, the array and the additional "text" question.
So it can not work in "question by question"

But as we always recommend:
Use groups with only one question per group and display "group by group".
This way you get advantages like
  • "look and feel" like "question by question"
  • option to merge several questions into one by javascript
  • option to display more than one question  on a page (e.g. rating and following reason for a poor rating)
Joffm
 

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose