Welcome to the LimeSurvey Community Forum

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

Choose 2 random options in multiple question

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 4 weeks ago #257613 by Vic1107
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)Hello dear forum,

I am creating a survey where I show a list of coffee shops in a multiple choice question with 8 options.

What I'm trying to do is take 2 random brands from this list if more than 1 brand was selected, that is:

If you select only 1 option, I only ask one question for that selected option.

If you select 2 options, I will ask my next two questions, for those two selected options.

But if you select more than 2 options, for example:

1
3
4
5
7
8

I must take 2 random marks from those 8 options.

What I did is a mark calculation with the equation
join(if(P0401_1 == "Y", "A", ""), if(P0401_2 == "Y", "B", ""), if(P0401_3 == "Y", "C", " "), if(P0401_4 == "Y", "D", ""), if(P0401_5 == "Y", "E", ""), if(P0401_6 == "Y", "F", ""), if(P0401_7 == "Y", "G", ""), if(P0401_8 == "Y", "H", ""))

And then take a random one that works well, but I've gotten stuck trying to figure out how to do it with 2 random ones.

I hope I have been clear, my English is not very good.

My Version 5.6.42+231024

PS: How can I attach an LSS survey so they can see the survey?
Thanks everyone for your help.

Please Log in to join the conversation.

More
1 month 4 weeks ago #257802 by jelo

PS: How can I attach an LSS survey so they can see the survey?
 
When you write a forum post here you have a section "Attachments" with  an "Add Files" button. That way you an upload and attach an LSS files to your post.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

More
1 month 3 weeks ago #257803 by jelo
LimeSurvey has no way to create dynamic lists which would help creating subsets of given answers and apply operations e.g. random pick on them.

But I'm often not sure that picking randomly is a good way. People know a lot of brands, but they seldom know them all very well.

You can let people select all brands they know and repeat the question two times with an array filter which removes the selected question.
Q1 What brands to you know?
Q2 Only shows the select brands from Q1 "What brand do you know /use the most?
Q3 Only shows the non selected brands from Q2 "What other brand do you know very good  / use very often?
That way you have two select brands which you can ask more questions and let people choose brands they can answer questions.
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 weeks ago - 1 month 3 weeks ago #257868 by holch

Jelo:But I'm often not sure that picking randomly is a good way.


That was also my first thought when I read the post. I am sure Joffm can show you how to do what you want to do. Just wait a little bit and he will show up. 

But I could imagine two easy approaches to this, directly out of the box.

1. Ask for the two most important brands if you don't need the others.

2. Ask two questions. the first one will ask them to tick all brands they know. Then the second one will only show the ones they know (filtered via array_filter) and then allow them to pick max. 2. If they have chosen just 1 or 2 brands, you can skip the second question.

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

Last edit: 1 month 3 weeks ago by holch.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 weeks ago #257932 by Joffm
This is answered already.
The TO created a new account.
So it's a double post 

Joffm 

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

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose