Welcome, Guest
Username: Password: Remember me

TOPIC: Show only 3 out of 10 questions in question group

Show only 3 out of 10 questions in question group 1 year 4 months ago #96661

Hi guys!
Here’s the case. I have a survey with 3 question groups, each of which has 10 question that need to be randomized (no problem with that). The problem is that I would like to show only 3 of those randomized questions in each group. How can I do that?
The idea is that people don’t need to reply to ALL questions per group, but only three, so that:

Person 1 sees: Group1 Questions 2, 4, 7, and Group2 Questions 6,1,8, and Group3 Questions 1, 10, 4
Person 2 sees: Group1 Questions 3, 9, 1…… and so on

Any ideas?
Thanks!
The administrator has disabled public write access.

Show only 3 out of 10 questions in question group 1 year 4 months ago #96677

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4256
  • Thank you received: 801
  • Karma: 367
There is a forum post somewhere about just such a scenario.

If I remember correctly,JavaScript is used to populate 3 hidden questions with mutually exclusive random numbers between 1 and 10. Then conditions/relevance is used to display the following questions.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Show only 3 out of 10 questions in question group 1 year 4 months ago #96685

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4256
  • Thank you received: 801
  • Karma: 367
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Show only 3 out of 10 questions in question group 1 year 4 months ago #96687

Hi Tony,
thanks a lot for your quick reply! :woohoo:

I am aware of the solution you suggest "Ask 1 question per group workaround"", which is very handy when one actually needs only 1 question per group. But, as pointed by DaveyKrebs in this post, it is a wanky solution when one needs to show more than 1 grouop/question.

Questions on “randomness” seem not to be that rare in this forum, as shown here and here (yes, me again :P), but I do believe there might be a solution… possibly.

In LS’s documentation, specifically in the Access to functions documentation, it is said that “it is easy to add new functions” (right before the first table of available functions). Well, apart from the fact that no instructions are provided on how to actually add functions easily, one could imagine a combined use of the array_rand() function (as shown here, see 2nd answer) for setting the selection of random non repeated values, and the in_array() function for setting question conditions. Something like this:

Calc1: (Qtype=equation) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Calc2: (Qtype=equation) foreach( array_rand(Calc1, 2) as $key ) {echo $Calc1[$key];}

After which questions could by randomized using a randomization group name, and have conditions that look like this:

Q1: conditions= in_array( 1, Calc2)
Q2: conditions= in_array( 2, Calc2)
And so on.

How could I implement this solution? Or better, is something like this even possible?
As always, many many thanks!!!!
The administrator has disabled public write access.

Show only 3 out of 10 questions in question group 1 year 4 months ago #96688

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4256
  • Thank you received: 801
  • Karma: 367
Unfortunately, I can't help you with intricate Expression Manager functions. For various reasons, I prefer JavaScript.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Show only 3 out of 10 questions in question group 1 year 4 months ago #96702

Hi Tony,
thanks a lot for the reply!!! Do you know by any chance someone in the LM team who could give me a hand with including new functions in EM?

I'm not a javascript expert (I'm not even a newbie ;)) but it seems like the solution you suggest it somehow similar to the one I'd like to implement (just with another language).... the idea for me is that this survey I'm putting together will be answered by people using tablets and, as you know, they tend to perform very poorly when you shoot them loads of code and javascript. That's why I prefer the back-end calculations, because although slightly heavier on the server, they will certainly guarantee a better experience for users on their devices...

Cheers!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.121 seconds
Donation Image