Can I pipe answers from a previous question into a Matrix Table | XM Community
Solved

Can I pipe answers from a previous question into a Matrix Table

  • 24 September 2019
  • 3 replies
  • 211 views

Userlevel 1
Badge
We are asking a Matrix table question and we want to pipe the answers from a previous question into the body of the matrix table; so the piped text sits next to the answer fields as a reminder of what they wrote previously. I have attached a screenshot of what it should look like.

There would be 7 columns in the table (excluding the choice labels) Four of the columns would contain piped text (Total, Previous Question A, Previous Question B, Previous Question C) and three columns for inputting data (Current Question A, Current Question B, Current Question C).

I'm hoping there is a javascript solution to this?


!
icon

Best answer by Peter_Furness 25 September 2019, 14:51

View original

3 replies

Userlevel 1
Badge
I figured out how to do it using this thread

https://www.qualtrics.com/community/discussion/comment/1506#Comment_1506

The key code for piping into the first column is as follows:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var $jq = jQuery.noConflict(); // initiation of new variable to avoid conflict

/* Col 1 with text */
var $arr5 = ['${q://QID3/ChoiceTextEntryValue/1}','${q://QID3/ChoiceTextEntryValue/2}','${q://QID3/ChoiceTextEntryValue/3}','${q://QID3/ChoiceTextEntryValue/4}','${q://QID3/ChoiceTextEntryValue/5}']; // this is the array for text to be shown in column 1 you may add text change text

$jq('.c4').not('th').each(function(i){
$jq(this).html($arr5[i]);
});


});
Hi Thanks for sharing. I am not familiar with Java script.
What is var $arr5?
where do i get the question ID from?
what do you mean by text change text?

Any help would be much appreciated thank you.
Userlevel 1
Badge
Hi Scagas,

I'm not that familiar with javascript but '$arr5 ' is a variable that is created in that script. In that variable you store the information you want to pipe into the table.

You can get the question ID by using the 'Piped Text' function - https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/piped-text-overview/

When I say 'change text' I mean the text that is stored in the $arr5 variable. In my instance I was piping in answers from previous questions so I wrote '${q://QID3/ChoiceTextEntryValue/1}', but you could write anything in there.

I hope that helps.

Leave a Reply