Using JavaScript to set one embedded data value to the value of another? | XM Community
Skip to main content

I can't seem to figure out how to accomplish this.
Using Javascript, I have established an embedded data variable called "stimuli_0_points". It works fine when I try to access it in a later block.
However, what I want to do is use Javascript to set another field, called "current_points" to whatever the value of "stimuli_0_points" is.
I have tried:
let test = "${e://Field/stimuli_0_points}";
Qualtrics.SurveyEngine.setEmbeddedData("current_points", test);

and also...
Qualtrics.SurveyEngine.setEmbeddedData("current_points","${e://Field/stimuli_0_points}");

Why does this not work? When I try and access ${e://Field/current_points} later on, it just comes back blank. I've tried using the above code both within the same block that stimuli_0_points was created and also in a separate block.

I think the problem has to do with when the embedded data was being set/accessed. I put a page break in between the two blocks of interest and it seems to have fixed the problem.
First block: sets stimuli_0_points
Second block: Sets current_points to stimuli_0_points -> PAGE BREAK -> displays current_points


Leave a Reply