Survey-library: (Weighted) Random Question Sets

Created on 1 Mar 2017  路  4Comments  路  Source: surveyjs/survey-library

Hello all,

surveyjs is a great tool!

I'd like to propose a feature request: "Random Question Sets".

Instead of always showing the same questions in the same order, questions are chosen randomly from a set (or container) of predefined questions.

A subset off all questions within that set is being asked, and each question is weighted, so that a question with a higher weight (probability) is drawn with a higher chance.

Random questions would be an extension of the pages element, and each question is extended by a probability element.

Something like (just a first draft, really):
javascript { pages: [ { name: "page1", useRandomQuestions: true, // false: normal behaviour; true: generate a randomized subset of all questions for this page numberOfQuestionsToPose: 2, // just ask a subset of all questions from this page (in this case 2 out of 3 questions) questions: [ { type: "comment", name: "question1", probability: 40 }, { type: "comment", name: "question2", probability: 20 }, { type: "radiogroup", probability: 60, choices: [ { value: "1", text: "first item" }, { value: "2", text: "second item" }, { value: "3", text: "third item" } ], name: "question3" } ] } ] }

What do You think?

All the best,
H.

enhancement question

Most helpful comment

@misamura It makes sense. I am not sure we will include this into the library, because you may do it on your side.
Add a property to all questions:
Survey.JsonObject.metaData.addProperty("questionbase", {name: "probability :number", default: 1});
And before setting the json into the survey, change the elements sorting as you wish.

However, I have added your suggestion into our discussion board. We may add a demo first, if we see there is an interest, include this functionality into the library.

Thank you,
Andrew

All 4 comments

@misamura It makes sense. I am not sure we will include this into the library, because you may do it on your side.
Add a property to all questions:
Survey.JsonObject.metaData.addProperty("questionbase", {name: "probability :number", default: 1});
And before setting the json into the survey, change the elements sorting as you wish.

However, I have added your suggestion into our discussion board. We may add a demo first, if we see there is an interest, include this functionality into the library.

Thank you,
Andrew

hi
this survey library is excellent for researchers. i would like to make one point. about this particular post regarding random question order.

i have medium programming ability, so i can modify something like this:
rateValues: [1,2,3,4,5,6,7],

because i need range of 7 instead of the default of 5.

however, when i look for randomizing the questions and i see:
Survey.JsonObject.metaData.addProperty("questionbase", {name: "probability :number", default: 1});

(would it be possible to get more detail about how to use the line above? like the "probability" - does that change the order?
i can see the idea but i don't know how to work with it.

in a scientific survey very often we need to randomize the question order. so i think it's useful to have a simple property like:
random: true

if possible, but i don't know how much work that requires.

in any case, this is a super great resource and i am grateful for this!!!

mark

@misamura , @andrewtelnov +1 on numberOfQuestionsToPose feature. Can we do it with custom properties?

Here is the example that does what you need.

Thank you,
Andrew

Was this page helpful?
0 / 5 - 0 ratings