Have an idea?

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

Show image based on quota assignment

I am showing an image in a CBC exercise that I would like to change based on a quota assignment determined earlier in the survey.  

For background, I'm doing this because one of the brand attributes in the CBC varies based on geographical location (i.e. the brand name/logo is different based on where US), so I'd like it to appear with the logo that should be most familiar to the respondent.

I have 4 groups/4 images I'd like to show, so something like this:

if quota=1 then imageshown=1
if quota=2 then imageshown=2
if quota=3 then imageshown=3
if quota=4 then imageshown=4

I feel like the link below has a response is close to what I need, but I've been toying with adjusting the code and can't seem to solve it.

https://legacy.sawtoothsoftware.com/forum/22269/show-image-based-on-variable?show=22269#q22269
closed with the note: Answered
asked Oct 15 by Leslie (120 points)
closed Oct 16 by Leslie
Hopefully I can help clear up any confusion about using that code.  I'd start by adding the four images to your graphics folder.  For ease, I'd give them the same name except with a single number changing from 1 to 4.  For example:

brand1.png
brand2.png
brand3.png
brand4.png


Then the image code you can use in your CBC just needs to be this:

[code]
<img src="[% GraphicsPath() %]brand[% QuotaQ %].png"/>
[/code

Of course, "QuotaQ" has to be replaced with the name of your quota question and you'd need to change the "brand" and "png" parts to match your image files.
Got it - brilliant solution, thanks!!
...