How to pipe answers (that are not HighestValue or LowestValue) from a rank order question? | XM Community
Solved

How to pipe answers (that are not HighestValue or LowestValue) from a rank order question?

  • 2 September 2019
  • 4 replies
  • 130 views

I am currently developing a multicriteria decision analysis survey using swing weighting. In the first block I would like respondents to rank 8 options from "most important" to "least important".

In the next block I would like respondents to give a numerical value to indicate how important each of these options is relative to each other using a slider. These options should appear in descending order of importance, as indicated by the previous question.

To do this I need to be able to pipe the "2ndHighestValue, 3rd HighestValue... 7thHighestValue" from the ranking question into the weighting (slider) question. How can I do this? So far I have only been able to pipe in the HighestValue and LowestValue.

Thankyou for any help you can provide!
icon

Best answer by Wheelerjack 23 September 2019, 01:17

View original

4 replies

Userlevel 7
Badge +23
Can you just pipe all the options, as you anyway ask about them all?
Oh, I misread that you want them in a particular order...
Badge
@Wheelerjack Here is a link to another answered question that might help you: https://www.qualtrics.com/community/discussion/2285/pipe-text-from-ranked-items#latest

It looks like "${q://QID28/ChoiceNumericEntryValue/1} is the rank of the first item,
${q://QID28/ChoiceNumericEntryValue/2} is the rank of the second item,
etc." might get the job done.

However, I've run into an issue with this. When I use that code, the resulting piped text is actually not text at all - it's the numerical value associated with the response.

Here is my code: !


And here is the resulting survey question: !


I need the names of the variables (such as "social equity", "portability") to show up instead of their values.

Does anyone have a way to fix this?

Thanks!
I had some help from a Java programmer who fixed this! Adding this script fixed my problem:
Hope this helps!

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
$(document).on('DOMSubtreeModified', function(){
var l=jQuery("ul li span.label span label span span span").length;
var s=[];
for(var i=0; i<=l;i++){
s[i]=jQuery("ul li span.label span label span span span:eq("+i+")").text();
}
var p=l+1;
for(var t=1;t<=p;t++){
var h=t-1;
Qualtrics.SurveyEngine.setEmbeddedData( 'r'+t, s[h]);
}
});

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});
Badge
@Wheelerjack

Thanks for that code!

What exactly did it do for you? I added it to my survey and nothing has changed - I still see the numerical value instead of the variable name. Have you been able to fix this problem?

Leave a Reply