Welcome to the LimeSurvey Community Forum

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

Random slect X out of Y Questions

  • unskilledking
  • unskilledking's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 8 months ago #187046 by unskilledking
Random slect X out of Y Questions was created by unskilledking
Hi Community!

i'm new to this forum, even though i've read a lot here within the last year.

I have a problem randomly selecting questions. I found some threads matching this but they are really old or not matching exectly my problem.

I have a questions group with 20 questions in it to be displayed. Each of this question has a different difficulty level and x questions to select from. Is there a way to get this working?

Example (difficulty level = df):
df1: Q1, Q2, Q3, Q4
df2: Q1, Q2
df3: Q1, Q2, Q3, Q4
df4: Q1
....
df20: Q1, Q2, Q3

The suvey group should look like this (example):
df1: Q3
df2: Q2
df3: Q4
df4: Q1
....
df20: Q2

This questions have to be the exact same if the user pause and continue the survey.

LimeSurvey Version 3.16.0+190225
No Customizations until now.

Thanks in advance!

Robert
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago #187049 by Joffm
Replied by Joffm on topic Random slect X out of Y Questions
Hi,
so you have 20 groups with different difficulty levels.
Each group contains 1 to four (or more) questions.
From each difficulty level you would like to select one question randomly.
Correct?

The easiest way:

First create 20 random numbers in questions of type equation. Like:
Question "Rand1": question text "{if(!is_empty(Rand1),Rand1,rand(1,[number_of_questions_in_df1]))}"
Question "Rand2": question text "{if(!is_empty(Rand2),Rand2,rand(1,[number_of_questions_in_df2]))}"

In each of your groups you select the displayed question by relevance equation
"df1Q1": relevance equation: Rand1==1
"df1Q2": relevance equation: Rand1==2
...
"df9Q3": relevance equation: Rand9==3
...


Because of this {if(!is_empty(rr),rr,rand(1,x))} the random number is only calculated if it is empty. If not, it keeps its value.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: unskilledking
The topic has been locked.
  • unskilledking
  • unskilledking's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 8 months ago #187051 by unskilledking
Replied by unskilledking on topic Random slect X out of Y Questions
Hi Joffm,

this i exactly what i needed.

Thanks a lot!

Robert
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose