Saving Loop and Merge Field into Embedded Data Variable

MartaMarta Community Member Qubie ✭

Saving Loop and Merge Field into Embedded Data Variable

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!

Best Answer

  • rondevrondev Wizard ✭✭✭✭✭
    Accepted Answer

    The setEmbedded data function should be like below:

    Qualtrics.SurveyEngine.setEmbeddedData("id", id);
    Qualtrics.SurveyEngine.setEmbeddedData("receiver1id", id);
    
Sign In to Comment