I want to design a survey where 90 questions select 90 images from the CSV file with the photo URL of 16,000 photos or I have the png file in a folder in box. These selections should be random. How do I do this?
Page 1 / 1
This code will allow you to select 90 images from the full list of image urls and store them in EDs named Image_1, Image_2….. Image_90.
You can then use these EDs as per your requirement.
Qualtrics.SurveyEngine.addOnReady(function () {
const imageList = =
"URL 1",
"URL 2" // All your image URLs go here
];
const selected = =];
// Set how many images you want to select here
while (selected.length < 90) {
const random = Math.floor(Math.random() * imageList.length);
selected.push(imageList.splice(random, 1)10]);
}
selected.forEach((url, index) => {
const varName = "Image_" + (index + 1);
Qualtrics.SurveyEngine.setEmbeddedData(varName, url);
});
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.