How to order questions based off a previous question's ranking | XM Community
Skip to main content

I've got a rank order question where you rank 10 categories from most important to least important.
I then have a single follow-up question about each category. Ideally I want to ask those in order, from most to least important.
Anyone know if that's possible? I'm open to custom code solutions as well if someone can think of one.

Hi mattyb513 ,
I think you can do this using JS, create 10 hidden question which will store ranked category in your previous ranked question and in each question just add the JS code to punch the category.
I once did the setup, I had matrix text entry question and allowed them to enter top 5 rank. I had created 5 dummy/hidden questions (for 5th, 4th, 3rd, 2nd and 1st rank) on same page and added the below JS code, I just updated the JS on each question to compare the rank.
The below JS is for 5th rank dummy question, in 4th rank question, just change the if condition and so on.
var rankarr = ['${q://QID78/ChoiceTextEntryValue/1/1}','${q://QID78/ChoiceTextEntryValue/2/1}','${q://QID78/ChoiceTextEntryValue/3/1}','${q://QID78/ChoiceTextEntryValue/4/1}','${q://QID78/ChoiceTextEntryValue/5/1}','${q://QID78/ChoiceTextEntryValue/6/1}','${q://QID78/ChoiceTextEntryValue/7/1}','${q://QID78/ChoiceTextEntryValue/8/1}','${q://QID78/ChoiceTextEntryValue/9/1}','${q://QID78/ChoiceTextEntryValue/10/1}']
var recodeArr = [1,2,3,4,5,6,7,8,9,10]
for(var i=0;i{
if(Number(rankarr[i]) == 5)
{
this.setChoiceValueByRecodeValue(recodeArr[i],true)
}
}

In the follow-up question, just take the selected choice of each question as a answer option.


Leave a Reply