Welcome to the LimeSurvey Community Forum

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

random selection of items

  • eyaskil
  • eyaskil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #230403 by eyaskil
random selection of items was created by eyaskil
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 5.3.18+220530
Own server or LimeSurvey hosting: Own server
Survey theme/template: vanilla
==================
Hello.

What I'm trying to do is this:

I present 8 questions to the respondents. Then I need to randomly choose 3 of them in order to use their contents for further questions.
for example, lets say I ask how much one consumes each of a list of 8 types of foods, like: bread, meat, eggs, plants, milk and so on.

Then I want to randomly choose 3 of 8 food types and ask about the perceived nutritional value of each type. i.e. I have to use the contents of 3 items selected at random and add it to further questions.

How do I do that?

Thanks,
Efrat.
 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #230428 by holch
Replied by holch on topic random selection of items
So they respond all 8 initial questions or might there be some that they don't respond?

If they respond to all of them, I would create the 8 corresponding questions later, into 2 question groups. One with 3 questions, one with 5 questions. The one with 5 questions you will hide and you give all these questions the same "randomization group name".

What happens? The 8 questions will appear randomly between the 8 positions, 3 in the first group that is shown, 5 in the second group that will be hidden. This way, you'll always display 3 of the 5 questions at random.

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.

  • eyaskil
  • eyaskil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #230434 by eyaskil
Replied by eyaskil on topic random selection of items
well, it's a bit more complicated than this.
because actually I have 2 series of 8 questions each, and I need to randomly select 3 of each and combine then into 9 (3X3) further questions.

I figured that if I can produce 3 random digits between 1-8 for each series, then I can condition the 9 combinations using these random digits.

I know how to create 1 random digit, using the function rand(1,8), but I don't know how to create 3 random digits. can you help me with that?

Thanks a lot.
Efrat.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #230436 by holch
Replied by holch on topic random selection of items

well, it's a bit more complicated than this.


You should have mentioned this from the beginning then.

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.

  • eyaskil
  • eyaskil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #230440 by eyaskil
Replied by eyaskil on topic random selection of items
You are absolutely right. I wasn't clear enough in my first message.
Still, I hope I can find some solution to my problem.
Thanks.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #230442 by holch
Replied by holch on topic random selection of items
Please explain a little further what you need from these 3 random digits.

Creating 3 random numbers is easy: Just create a different equation type question for each random number. You should not use {rand(1,8)} though, because the random number would change everytime you "touch" it. Therefore we recommend with "randnumber" being the question code of the equation question itself, where this code is:

{if(is_empty(randnumber),rand(1,4),randnumber.NAOK)}


But I feel like there is more to it than just creating 2x 3 random numbers. I assume within each set of 3 random numbers you will want them to be unique?

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.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 9 months ago #230447 by tammo
Replied by tammo on topic random selection of items


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose