Welcome to the LimeSurvey Community Forum

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

Adding "Other:" option to array

More
2 months 2 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
2 months 2 weeks ago - 2 months 2 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] manual.limesurvey.org/ExpressionScript_-....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: 2 months 2 weeks ago by Joffm.

Please Log in to join the conversation.

More
2 months 2 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
2 months 2 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.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

More
2 months 2 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
2 months 2 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
2 months 2 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.

Lime-years ahead

Online-surveys for every purse and purpose