Solved
Add data to a embedded data field (Number Set)
Hello everyone,
I have a loop and merge block where I generate different images in the addOnReady function. Since the loop runs the same code, I have only one embedded data field, I called it 'userChoice1' and the code I used is:
`Qualtrics.SurveyEngine.addEmbeddedData('userChoice1', confirmFinal() );`
I want to record the variable 'userChoice1' in every single iteration of the loop, but I can only record the last one with this code. Can this embedded field be like a array where I can push in data on every loop? Thanks.
userChoice1 is also set as a "Number Set" type embedded data.
Thanks!
Best answer by fleb
I was dealing with a similar problem. I have created one embedded field and at each iteration of Loop and merge I took it and concatenated my actual value to it and a separator.
If you want to use it again later in the questionnaire, you can split it using the `split` method easily. (Values are in the randomized order, not the original one if the loop is randomized)
My original resource is here.
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
var questionText = "${lm://Field/1}" + ";"; //Takes field1 from Loop and merge (replace it wit your value of choice1) and adds a semicolumn to it
var order = "${e://Field/efield}"+ questionText; //gets the old value of e. field and concatenates a new value to it
Qualtrics.SurveyEngine.setEmbeddedData("efield", order); //updates the e. field
});
View originalLeave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.