Carry forward rankings from rank order question | XM Community
Skip to main content
Hello, I need to do something relatively simple but I can't figure it out. I want to give participants a Rank Order question, after which I give them some information, then give them the same rank-order question to see whether they will change their rankings. The second time the question appears, I want it to carry forward their previous rankings (and give them the chance to change the order).



Looking through this forum, I've seen a few similar (but more complicated) questions, with answers that say you need to use JavaScript and embedded data. For example, this question includes some suggested JavaScript: https://www.qualtrics.com/community/discussion/5880/how-to-pipe-answers-that-are-not-highestvalue-or-lowestvalue-from-a-rank-order-question ...but it doesn't say what to do after pasting that in. I've read through the Qualtrics documentation for embedded data but that only tells you how to create embedded data elements, not how to use them to save data from one question and pipe it into another.
You don't need embedded data, and you may or may not need JavaScript depending on the type of rank order question you are using.



What type of rank order question are you using?
I'm using a Drag and Drop rank order.
> @Melly82 said:

> I'm using a Drag and Drop rank order.



If you use a Drag and Drop, you'll need to use JavaScript to put the choices in rank order. Pipe all the choices and ranks into your follow-up question, then rearrange the choices based on the ranks.



You can avoid JavaScript if you use a Text Box Rank Order question and set the default answers to the ranks in the first question.
Drag and Drop is ideal for our needs. Do you know where I can find the syntax for piping the choices and ranks (if I keep the Drag and Drop option)? I'm pretty new at this, and I'm happy to read through documentation, but I can't find this information anywhere.
> @Melly82 said:

> Drag and Drop is ideal for our needs. Do you know where I can find the syntax for piping the choices and ranks (if I keep the Drag and Drop option)? I'm pretty new at this, and I'm happy to read through documentation, but I can't find this information anywhere.

The best way to find the piping syntax is to go to the question text of the follow-up question, click on Piped Text.. and choose the appropriate fields from the first rank order question.
I don't see any options that me to pipe in items based on their previous rankings, aside from the highest and lowest. For example, in Question 1, say the participant is given these items:



What about Bob

Ghostbusters

Groundhog Day

Caddyshack



...and the participant ranks them in this order:

Ghostbusters

Groundhog Day

What about Bob

Caddyshack



When creating the answer choices for Question 2, I can make the first one: ${q://QID1/ChoiceGroup/ChoiceWithLowestValue} and it will correctly display Ghostbusters in the first position (similarly, I can use Highest to put the Caddyshack in the last position). However, those are the only Piped Text options I see, and I need to know how to Pipe in the remaining options (ranked 2, 3, etc.) in the correct positions.
> @Melly82 said:

> I don't see any options that me to pipe in items based on their previous rankings, aside from the highest and lowest. For example, in Question 1, say the participant is given these items:

>

> What about Bob

> Ghostbusters

> Groundhog Day

> Caddyshack

>

> ...and the participant ranks them in this order:

> Ghostbusters

> Groundhog Day

> What about Bob

> Caddyshack

>

> When creating the answer choices for Question 2, I can make the first one: ${q://QID1/ChoiceGroup/ChoiceWithLowestValue} and it will correctly display Ghostbusters in the first position (similarly, I can use Highest to put the Caddyshack in the last position). However, those are the only Piped Text options I see, and I need to know how to Pipe in the remaining options (ranked 2, 3, etc.) in the correct positions.



To pipe the ranks, pick the choices' values (the items after choices' descriptions in the drop down). Once piped, they will look something like: ${q://QID1/ChoiceNumericEntryValue/1}
Unfortunately, that doesn't do it. That just displays a number.
> @Melly82 said:

> Unfortunately, that doesn't do it. That just displays a number.

The numbers are the ranks. You would pipe them into JavaScript and use them to reorder the choices.
Ok, that sounds great... so what I'm looking for is the syntax to pipe them into Javascript (to make them appear in that order in the next question).
> @Melly82 said:

> Ok, that sounds great... so what I'm looking for is the syntax to pipe them into Javascript (to make them appear in that order in the next question).



You're looking for JavaScript code. You need to write it or have someone write it for you.
I'm trying to write it myself, and I know some basic JavaScript (and several other programming languages, so I am comfortable with creating and sorting arrays and such). But what I don't know is the syntax for using JavaScript to pipe responses from a Qualtrics question, or the syntax for piping JavaScript back out into the answers for a Qualtrics question. I can't find any documentation on this.
> @Melly82 said:

> I'm trying to write it myself, and I know some basic JavaScript (and several other programming languages, so I am comfortable with creating and sorting arrays and such). But what I don't know is the syntax for using JavaScript to pipe responses from a Qualtrics question, or the syntax for piping JavaScript back out into the answers for a Qualtrics question. I can't find any documentation on this.

>

Put the pipe string in quotes in the JS. For example:

```

var myVar = "${e://Field/myVar}";

```

Hi Melly82, I'm looking for the exact same thing as you were back then. I'm not familiar with Java Script, but do you maybe have the code you used that I could have a look at and adjust to my needs?



I too am now looking for this - does anyone have some example code?

thanks

Neil 


@maillme - You might be interested in the captureRanks function.


Tom, that looks like it could help - I’ll give it a try - and if I can’t get it to work - I’ll be in touch :-)

thank you!!!


Are there any free resources on using this with a Text Entry rank order question format? (Considering this is a Community and not a professional consulting/tech service, I’m not looking to pay for potentially public knowledge.)

I have ~20 items and am asking people to rank up to 5, with follow-up questions referring only to the items ranked 1st and 2nd, which I’d like to pipe into the static text appearing above the follow-up questions to keep them in respondents’ mind. I’m using Survey Flow to create embedded data fields for RankedFirst and RankedSecond (ignoring the rest of the rankings given, if any).

The item ranked 1st can be taken care of with ChoiceWithLowestValue text piping in Survey Flow, and I’m trying to avoid writing 19 conditional statements for the remaining items just to capture whatever was ranked 2nd (not necessarily ChoiceWithHighestValue).

Thanks!


Are there any free resources on using this with a Text Entry rank order question format? (Considering this is a Community and not a professional consulting/tech service, I’m not looking to pay for potentially public knowledge.)

I have ~20 items and am asking people to rank up to 5, with follow-up questions referring only to the items ranked 1st and 2nd, which I’d like to pipe into the static text appearing above the follow-up questions to keep them in respondents’ mind. I’m using Survey Flow to create embedded data fields for RankedFirst and RankedSecond (ignoring the rest of the rankings given, if any).

The item ranked 1st can be taken care of with ChoiceWithLowestValue text piping in Survey Flow, and I’m trying to avoid writing 19 conditional statements for the remaining items just to capture whatever was ranked 2nd (not necessarily ChoiceWithHighestValue).

Thanks!

@Katch This post might help you Piping from a ranking, to a ranking - in the same order | XM Community (qualtrics.com)


Leave a Reply