Hi all,
I have a question in which I store each change value of a slider in an Array and each time export this array in the same Embedded Data called "p_guesses_x" where x corresponds to the current Loop & Merge round.
What is very weird is that trying to complete the survey this "p_guesses_x" variables only contain one value, instead of being a list, even if more than one value was clicked on the slider.
I tried checking with console.log(list_left) and printing the Embedded Data inside the survey and it seems to work perfectly, the variable being printed with the form "VALUE, VALUE, VALUE,...". However, in the final DB, the list is not there anymore.
Please find an example of the code I am using below.
var list_left = [];
var round = "${lm://CurrentLoopNumber}";
document.getElementById("topleftSlider").onchange = function() {
getValuetopleft();
jQuery("#NextButton").show();
};
function getValuetopleft() {
var val = document.getElementById("topleftSlider").value //get the oninput value
list_left.push(val)
Qualtrics.SurveyEngine.setEmbeddedData('p_guesses_' + round, list_left)
}
What could be the cause of this weird behavior? Thanks a lot for your replies and help :)
Solved
Embedded Data containing Arrays not stored in final DB
Best answer by TomG
You can't store an JS array as an embedded data field. You have to stringify it somehow. Try this:
Qualtrics.SurveyEngine.setEmbeddedData('p_guesses_' + round, list_left.join(","));
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
