Extract Loop and Merge Fields to Results with order of loop presentation | XM Community
Solved

Extract Loop and Merge Fields to Results with order of loop presentation

  • 28 April 2021
  • 2 replies
  • 118 views

Hi,
This code was used before, inserted in the question with the piped loop and merge info .
The loop and merge had 3 fields: the 3rd one was presented in the question (object picture link), the other two were usefull information for data analysis purpose (e.g., field1 with name of the object and field 2 with condition). In the survey flow, "set embedded data", the variables were set as "fld1" and "fld2" with the "text set" option.
This code allowed to extract the information of the fields in the order that were presented to the participant separeted by "/". E.g., participant 1 saw "bracelet/jar/sunglasses"; participant 2 saw "jar/sunglasses/bracelet". Very useful! Now it does not work.
Can you see what is wrong with it and/or guide me to a solution?
Thank you :)

Qualtrics.SurveyEngine.addOnload(function()
{
});
var fld1words = "${lm://Field/1}"; 
var orders1 = "${e://Field/fld1}"+ "/" + fld1words; 
  Qualtrics.SurveyEngine.setEmbeddedData('fld1', orders1);
var fld2words = "${lm://Field/2}"; 
var orders2 = "${e://Field/fld2}"+ "/" + fld2words; 
  Qualtrics.SurveyEngine.setEmbeddedData('fld2', orders2)

icon

Best answer by ahmedA 28 April 2021, 22:40

View original

2 replies

Userlevel 7
Badge +21

The code looks fine, just place it inside the method like this:
Qualtrics.SurveyEngine.addOnload(function()
{
var fld1words = "${lm://Field/1}"; 
var orders1 = "${e://Field/fld1}"+ "/" + fld1words; 
  Qualtrics.SurveyEngine.setEmbeddedData('fld1', orders1);
var fld2words = "${lm://Field/2}"; 
var orders2 = "${e://Field/fld2}"+ "/" + fld2words; 
  Qualtrics.SurveyEngine.setEmbeddedData('fld2', orders2)
});

https://www.qualtrics.com/community/discussion/comment/36966#Comment_36966Indeed! It works! Thank you for looking :)

Leave a Reply