Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: random question sets

random question sets 2 years 9 months ago #70661

  • jochem
  • jochem's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Dear LimeSurvey users/developers,

I really like the random question sets workaround:
docs.limesurvey.org/Workarounds%3A+Survey+behaviour

However, I would like to display the questions in the set in a question by question format not group by group. Any suggestions?

warm regards,

Jochem
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70662

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Can you link the certain workaround directly so we all know what you are referring to?

At the next (or even the current?) Limesurvey version there is a feature to randomize all questions of a certain group. Have a look at docs.limesurvey.org/Advanced+question+se...no_bl=y#random_group

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70674

  • jochem
  • jochem's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Dear Mazi,

Here is the direct link:
docs.limesurvey.org/Workarounds%3A+Surve...Random_question_sets

I saw the page you refer to.

Here the problem will be that I do not want to randomize and show all questions one by one of a certain group but just a random set of the group one by one (e.g. 4 out of 10).
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70676

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Sorry, but as stated at the workaround page, we can't give support for those workarounds. Your problem probably requires some custom coding.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70692

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4192
  • Thank you received: 788
  • Karma: 359
You will not be able to accomplish this with JavaScript - it would require modifying the core code which I don't recommend.
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.

Re: random question sets 2 years 9 months ago #70694

  • jochem
  • jochem's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Thank you for thinking along.

Suppose I would like to ask 4 random questions out of a set of 10 (question by question). I put my 10 questions in a group and copy this group 4 times.
I could now use random question sets to pick one random question for group 1.
I do the same for group 2, 3 and 4.

The obvious problem is of course that I could pick the same question, which I do not want. Could we set a cookie with the value of the question(s) we picked in the previous group(s) and check if the new value is different?
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70696

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4192
  • Thank you received: 788
  • Karma: 359
The random question sets workaround that you linked to will only work if all questions are on the same page.
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.

Re: random question sets 2 years 9 months ago #70697

  • jochem
  • jochem's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Thank you. I know.


But I copy my groups. I use the workaround in 4 different groups. (In my proposed 'solution' each groups contains the same ten questions. I pick one random question in each group.)

In your workaround you check if you already shuffled the questions:

// Check to see if the question order has already been shuffled in this session

var cookieArray = getCookie ( 'sArray' + gID + '_' + sessionName );
// If already shuffled, use that question order
if ( cookieArray ) {
//qArray = $.trim(cookieArray);
qArray = cookieArray.split(',');
}
// If not, go ahead and shuffle

So, if we now not only could check in Group 2 if there is a cookieArray set in Group 1 but also check if the first element of qArray of Group 2 is different than the first element of cookieArray it may work. (If the cookieArray has to be on the sampe page, we may need to fill a predefined question with the value of its first element.)

...unfortunately, I do not know php. But I guess you already figured that out.
Last Edit: 2 years 9 months ago by jochem.
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70698

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4192
  • Thank you received: 788
  • Karma: 359
Ah, I see where you are going. But a problem is that the questions are identified by ID which would be different in each group.

Maybe a simpler way to deal with it would be to:

1) Create 4 groups, each containing all 10 questions as you suggest.

2) In every group, use JavaScript to add a class to all questions - Q1, Q2, Q3... That way all common questions in each group could be identified with a common class.

3) In every group, hide all questions, shuffle an array of all of the new question classes and then show the first class.

4) In every group, load a hidden question with the class of the displayed question. This could be used to show the same question if a respondent returns to the group and to prevent this question from being shown in subsequent groups.

5) In groups 2, 3, and 4, use {INSERTANS} to find the question classes previously shown and remove them from the array before shuffling.
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.
Last Edit: 2 years 9 months ago by tpartner.
The administrator has disabled public write access.

Re: random question sets 2 years 9 months ago #70829

  • jochem
  • jochem's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Hi Tony,

Apologies for the late reply.

Great to hear that the logic might work. I am afraid that I need some more php knowledge/experience or examples from you how to make the necessarry steps.

But if i put all my items in different groups (one item per group) couldn't I also follow the procedure described here?

docs.limesurvey.org/Workarounds%3A+Surve...f_groups_in_a_survey

the crucial part for me is of course:
"
Note: If you wish to select only a limited number of groups from a larger set, replace
$scratcharr = array_merge($scratcharr, $randarr);
with
$scratcharr = array_merge($scratcharr, array_slice($randarr,0,x));
"

Okay, I tried but it only works if I use this trick once in a survey. (in fact I want to do it twice: ask 4 random questions of two different set of 10 questions).

see also:http://bugs.limesurvey.org/view.php?id=557

It looks like more people would like this option in limesurvey.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.121 seconds
Donation Image