Page 1 of 1

Show image on roster

Posted: March 9th, 2022, 11:29 am
by Arjun Brti
Dear team

In a survey, there are 50 medical equipment and its uses on the roster format. I want to show the image of each item in the capi question. How to set the image for each occurrence.

Thank you.

Regards
Brti

Re: Show image on roster

Posted: March 9th, 2022, 3:51 pm
by aaronw
Each field's CAPI question text includes the ability to add conditions. You could add a condition for each of the 50 occurrences like this:
capi-condition.PNG
Then select each condition and add the image for that occurrence.

Re: Show image on roster

Posted: March 11th, 2022, 8:55 am
by Gregory Martin
Another option, if you are comfortable editing the question text HTML, is to call a function that gives you the name of the image. That may be easier to maintain than keeping track of 50 separate occurrences of question text. The HTML may be something like:

Code: Select all

<p><img src="~~GetImageFilename()~~"></p>
And then this, as an example, alternates between providing two images:
function string GetImageFilename()

    if systime() % 2 = 0 then
        exit
"image1.jpg";
    else
        exit
"image2.jpg";
    endif;
   
end;