Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

How to randomize pictures

I want to show one of two pictures in my survey. There are the same questions to both pictures. How can I randomize the showing picture?
Sawtooths Software: Lighthouse Studio
asked Jan 25, 2018 by BK
retagged Jan 25, 2018 by Walter Williams

2 Answers

0 votes
Save your 2 images in your graphics folder.

You can create a parent list (let's call it ImageList) with each image defined as such ...

1 <img src="[%GraphicsPath()%]Image1.png">
2 <img src="[%GraphicsPath()%]Image2.png">

Note: rename the images in 1+2 to your desired image names.

Now create a constructed list (call it ImageConList) and it will use the parent list ImageList ...

This will randomise your 2 images.

When you want to display your image in question script, simple use something like this ...
Please rate the following image: [%ListLabel(ImageConList,1)%]

The first image in the randomised constructed list will be displayed in your question script.

You can export the constructed list in your data and the 1st item in this list will represent the displayed image.

If you want to go a little more fancy, create a variable like ImageDisplayed in your Pass-In fields and define it as a whole number.

Pop this into any of your questions in the footer (make sure the question isn't one that is skipped over) ...
answered Jan 25, 2018 by Paul Moon Platinum (89,880 points)
0 votes
Hi BK,

You can do it many ways:
1. Make two set of questions for each image. Use those questions in Block Randomization. Make a constructed list for this Randomization with parent list having two members



Call this List in Block Randomization Section. This method will give you data for two images in two set of questions

2. Make only one set of question (if questions for both the images are same). Make a parent List of these two images and make a constructed list of randomizing and selecting only one

<img src="[%graphicspath%]\a.img">
<img src="[%graphicspath%]\b.img">


Show [%listlabel(forRandomization,1)%] in the question
answered Jan 25, 2018 by TarunKhanna Bronze (830 points)
This works.
Thank you.
You are welcome :)