Saving Loop and Merge Field into Embedded Data Variable | XM Community
Solved

Saving Loop and Merge Field into Embedded Data Variable

  • 8 May 2020
  • 1 reply
  • 219 views

Badge +3

Hi everyone,
In my Qualtrics survey, I have a question for which I use loop & merge. Field 1 is an id that takes values 1 or 2 (for testing purposes). I set the loop and merge to randomize loop order and present only 1 of total loops.
At the top of the survey flow, I create an embedded data variable "id" (and "receiver1id"), leaving it empty.
In javascript I write the following code. The problem is that id and "receiver1id" are always empty. Could anyone point out my mistake?

Qualtrics.SurveyEngine.addOnload(function()
{
//input 
var id = parseInt("${lm://Field/1}");

// output to id
Qualtrics.SurveyEngine.setEmbeddedData(id, receiver1id);
Qualtrics.SurveyEngine.setEmbeddedData(id, id);


});

Thank you!

icon

Best answer by rondev 8 May 2020, 00:34

View original

1 reply

Userlevel 7
Badge +22

The setEmbedded data function should be like below:
Qualtrics.SurveyEngine.setEmbeddedData("id", id);
Qualtrics.SurveyEngine.setEmbeddedData("receiver1id", id);

Leave a Reply