Matrix Likert Table Script | XM Community
Skip to main content

Hello! I'm trying to set up a workflow that enters a row in Excel.
I have a Matrix Likert table and I want to split the results up by a line break instead of a comma. I'm not even sure where to begin. My rudimentary research led me to put the following code in Javascript:
var sampleString = "${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/1}";
var comma = ", ";
var sampleArray = sampleString.split(comma);
var sampleOne = sampleArray[0];
Qualtrics.SurveyEngine.addEmbeddedData ("sampleOne", sampleOne);
alert(sampleOne);
but I suspect I need to put an Embedded Data block in the survey flow, but I'm not sure what variables and how to pull the information from my code... My alert box also shows up as a blank so I'm assuming my code is wrong too, anyways.
Thank you in advance for your consideration in helping!

tobyhkim Could you explain a little more about what you want the end result to be? If you're exporting the answer choices to Excel, I'm unsure what you're working towards with linebreaks/commas.


Hi jmborzick,
Thank you for your help! So if I have the following question:
Screen Shot 2022-10-27 at 3.29.41 PM.pngand someone selects "Scale Point 1" for "Statement 1", "Statement 2", and "Statement 3" I would want the workflow to give me a row in Excel that looks like this:
Screen Shot 2022-10-27 at 3.30.46 PM.png


tobyhkim I understand now. I'm sorry, but my best solution is to export the data to Excel in one tab that will be used only for the export. I'd then use formulas on a secondary tab to reformat everything into the appropriate format. This would include concatenating the three columns into one cell with the line breaks (char(10)).


jmborzick
I see... Is there a way to at least get each data point into three different columns? I'm struggling even with that aspect. So three columns, "sampleOne", "sampleTwo", and "sampleThree" and the rows respectively would show "Statement 1", "Statement 2", "Statement 3".


tobyhkim
Why don't you use 3 embedded data with these values and you will get it in 3 columns. Include this after the questions block.

${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/1}

${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/2}

${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/3}

Hope it helps!


tobyhkim When you're mapping the fields to your spreadsheet, you'll want to scroll down to the bottom and choose the fields corresponding to your rows (see screenshots)
image.png
image.png


Deepak And there isn't a way to manipulate the embedded data to return an array like jmborzick is saying, correct?
${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/1/1}
${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/1/2}
${q://QID13/ChoiceGroup/SelectedChoicesForAnswer/1/3}
for example


tobyhkim
No within Qualtrics if you want it concatenate include the three values in a embedded data comma separated and make it as text set it will allow you to view it on dashboard as each entity differently and within export as comma separated entity.
Hope it helps


Leave a Reply