Displaying image from Loop & Merge | XM Community
Skip to main content

Hi everyone, 

 

I’m struggling with a project where I am trying to feed in an image from Loop and Merge to be displayed in a survey question. In my project, participants are shown two ‘teams’ of individuals and are asked to memorize their team affiliation and answer quiz questions on it. 

First I used span to include the gender, name, and image associated with each team member:

Then through Loop and Merge associated each variable with a Field and number:

Then I fed this into the question:

Here’s what I’m struggling with right now: 

  • Even though the name and team comes through when I feed it into the question, the image is just shown as a link rather than the image itself. How can I make sure the actual image is shown?
  • I’ve included embedded variables and included this in the JavaScript so that the order of the randomization is shown in the data analysis, but when I look at the output those variables are empty. Why is this and what do I need to change to have the randomization saved?

     

  • I also want to be able to see if they get the question right or now. Right now they are shown a check if they get it correct and an X if they get it incorrect. Is there a way to save in the output which image they are shown (if that is the easiest way to record this information)?

Thank you so much for your help and please let me know if there is any other information I should be including to fix these problems. 

Hi @heatherdoherty ,

For the first point , The reason  is that you are piping the link only.
To get the image out of that link use it inside a image tag <img> like as below :

 

<img src="${lm://Field/2}">


Hope this resolves your query😊!!

PS: Looking into other two points


I’m still having a bit of trouble - when I paste that text into the question itself, my preview looks like this: 

And when I insert it into the html I get this: 

Am I putting the code in wrong?


 

I’m still having a bit of trouble - when I paste that text into the question itself, my preview looks like this: 

And when I insert it into the html I get this: 

Am I putting the code in wrong?


My bad for not clarifying beforehand, please paste the above line of HTML code  in the HTML code block  as below :


 


Hope this resolves your query😊!!

PS:I can't reproduce the second error on my end; the code appears to be functioning correctly. Could you share additional details ?


When I put that into the html, I still am shown the image icon rather than the actual image itself. Do you know why that might be?

 

For the second error, are you able to get the randomization saved through the output at the end? That is the error I am struggling with - though the randomization is working, the output is blank and I cannot see if they got the quiz questions right or not. 


@heatherdoherty I was just checking the link you were including. It seems like there is no such file in your Qualtrics library. Hence it is showing you as icon. 

 

Please let me know if you are still not able to get randomization working. Very simple would be creating a text question and populating currentloop number in that. And hide this question using css or JS.

 


Thank you for your reply! I uploaded these files into my library and took the links from the “...” under actions, then clicked “copy graphic” and “copy link”. Is there a better way to do that which will give me a valid link?

 

The randomization is working, but I’m unable to save the order of the randomization or if the participant gets the quiz question correct or not. If you could give me more information on how to set up that I would really appreciate it! Thank you!


@heatherdoherty I think for randomization, it might be due to layout. By any chance you are using simple layout? Can you change the layout in look-n-feel and then check.


It looks like I’m using the ‘Flat’ layout. Should I change it to something else?


Can you check if you have any errors in browser console? Right click and inspect on the browser and then navigate to console tab.


Leave a Reply