Dynamic statements javascript | XM Community
Skip to main content

I need to get a matrix question statements populated dynamically. The statements will be included in a contact list field separated by commas. I think the best way to get this done is using javascript. Any ideas on this? Thank you.

Yes,  you can parse the list and save the items to embedded data fields.  Then pipe those fields into your matrix on a subsequent page:

Qualtrics.SurveyEngine.addOnload(function() {
"${e://Field/cslist}".split(",").forEach(function(val,i) {
Qualtrics.SurveyEngine.setEmbeddedData("stmt"+(i+1),val);
});
});

 


Great! Is there a way to skip the pipe action (manually) and automatically populate statements in the matrix question using the generated embedded data fields?


Great! Is there a way to skip the pipe action (manually) and automatically populate statements in the matrix question using the generated embedded data fields?

Yes, you can update the innerHTML of the labels.  You still might want to set embedded data fields to record what statements were shown to the respondents.


Leave a Reply