I want to display to the respondent one of the randomly selected questions of the whole survey (100 questions), and his/her choice of that question. What I did but failed, is that I set a question ID to be embedded data randQID = ${rand://int/1:100}, and I replace question ID in the piped text with my randQID in order to display that randomly selected question's choice description and its selected choice.
One randomly selected question is ${q://QIDrandQID/ChoiceDescription/1} or ${q://QIDrandQID/ChoiceDescription/2}, and your choice is ${q://QIDrandQID/ChoiceGroup/SelectedChoices}
What should I do to make it possible?
Page 1 / 1
We cannot dynamically call the qid from client side.
Hence create a key value pair array in JS where in key will be the piped in question text and value will be its respective piped in selected choice. Randomize this array and select any key value pair to display.
@rondev
Are you saying create an object JS like the following? I selected one random number. How do I display the key and value to a question in the survey of the type a descriptive text?
var object = {};
object[‘${q://QID1/ChoiceDescription/2}'] = ${q://QID1/ChoiceGroup/SelectedChoices};
objectc‘${q://QID2/ChoiceDescription/2}'] = ${q://QID2/ChoiceGroup/SelectedChoices};
…
objecto‘${q://QID100/ChoiceDescription/2}'] = ${q://QID100/ChoiceGroup/SelectedChoices};
randomN = Math.floor(Math.random() * object.length);
Are you saying create an object JS like the following? I selected one random number. How do I display the key and value to a question in the survey of the type a descriptive text?
var object = {};
object[‘${q://QID1/ChoiceDescription/2}'] = ${q://QID1/ChoiceGroup/SelectedChoices};
objectc‘${q://QID2/ChoiceDescription/2}'] = ${q://QID2/ChoiceGroup/SelectedChoices};
…
objecto‘${q://QID100/ChoiceDescription/2}'] = ${q://QID100/ChoiceGroup/SelectedChoices};
randomN = Math.floor(Math.random() * object.length);
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.