Welcome to the LimeSurvey Community Forum

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

randomize selected 1-2 in multi qusetions

  • zn0610
  • zn0610's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 weeks ago #183056 by zn0610
Hi Team

I have a complicated logic related with MA selected and randomize setup 1-2 option for next 2 Array questions was asked.

Details:

There is 1 MA question with 10 options and respond can selected 1-10 options.

If selected option size>1, then in next question will randomize selected 2 options and shown for next 2 Array questions(like Q2a and Q2b).Like:
Q2aWhy do you selected in Q1(brand1).
Q2bWhy do you selected in Q1(brand2).

But if there is one option like option7(brand 7) was selected, must ask option7 in next SA question and randomize selected one option to asked from others.
If not including option7(brand 7), randomize selected 2 options and asked in next 2 Array questions.

Not sure if clear, thanks

Jerry
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago #183061 by Joffm
Replied by Joffm on topic randomize selected 1-2 in multi qusetions
Hi, not very clear.
As far as I understand:
There is a multiple question with 7 items, The respondent may select 0 to 7 items.
There are 2 question groups about 2 items.

Now there are three scenarios:
1. Resp, selects 2 or more -> select randomly 2 out of the selected items
2. Resp, selects 1 item -> select this one and randomly 1 out of the not selected items
3. Resp, selects 0 item -> select randomly 2 out of all items

Correct?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago - 5 years 2 weeks ago #183070 by Joffm
Replied by Joffm on topic randomize selected 1-2 in multi qusetions
If I understood,
here is a working example.
It uses only LS internal functions (like "rand", "strlen", "substr", "str_replace" and "join"), no javascript.
I used letters to identify the brands; later you can use this in relevance equations like "b1=="F".

More than one item selected:

[hr]Only one item selected:

[hr]No item selected:


File Attachment:

File Name: limesurvey...4-09.lss
File Size:31 KB


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 2 weeks ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • zn0610
  • zn0610's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 weeks ago #183141 by zn0610
Replied by zn0610 on topic randomize selected 1-2 in multi qusetions
Hi Joffm

Sorry for late responds.

Thanks a lot for your help, that's very helpful.It's correct.

Just one thing, there is another condition:
If selected option7(like brand7), must show brand7 first.
It's very important brand and priority to show.

Logic:
Q3 is Multi questions(number is 1-7).
IF BRAND SELECTED IN Q3 IS Brand7 THEN ASSIGN THE Brand7 AND ANOTHER RANDOMISED BRAND.
IF Brand7 IS NOT SELECTED Q25 (NOT AWARE OF Brand7) THEN ALLOCATE THEM TWO RANDOMISED BRANDS.
RESPONDENT TO BE SHOWN ONE BRAND AT A TIME to below questions.
Q26a and Q26b(if Q3.size>1)
Q26a. please selected statements for randomize shown brand1
Q26b. please selected statements for randomize shown brand2

Thanks

Jerry
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago #183146 by Joffm
Replied by Joffm on topic randomize selected 1-2 in multi qusetions
Hi,
then you just extend the example.

Now you have to distinguish between:
1. 1 brand selected -> this brand (Brand 7 or not) + 1 random brand
2. 2 and more
  1. Brand 7 was selected -> Brand 7 + 1 random brand
  2. Brand 7 was not selected -> 2 random brand
3. No brand selected: -> 2 random brands

All except the blue scenario are already covered.
In the green scenarios (which just select 2 random brands) you have to add a relevance of "Brand 7 not selected" which is obvious in 3.

Good luck
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose