Hi! I’m trying to randomize my question text using Javascript.
The survey flow looks like this:
I have an embedded data called Identifier, and I put it above the question block in my survey flow.
Question 1 (Welcome) has the following Javascript:
Qualtrics.SurveyEngine.addOnload(function() {
function generateIdentifier() {
var identifiers = v"Asian", "African", "European"];
var randIndex = Math.floor(Math.random() * identifiers.length);
return identifiersrandIndex];
}
var identifier = generateIdentifier();
Qualtrics.SurveyEngine.setEmbeddedData('Identifier', identifier);
});
Question 2 (in a separate block) uses the following piped text:
${e://Field/Identifier} Golden Fab Tree
However, nothing displays in the question piped text when I preview. What might be the problem?