How to Pulldata Images

hello, it’s an appreciation to be able to join the amazing kobo community. Please help, I’m currently working on a form for risk screening for predicting heart and blood vessel disorders using a chart from the WHO (WHO CVD Risk). Conceptually, when the variables of gender, age range, smoking habits and diabetes tendencies have been selected, the chart data (image) will automatically appear on the form (pull data for images). I tried to find a discussion about it and I found a reference in this link
. I tried to make a design for the xls form and CSV data according to the instructions but after deploying all the images appeared, I couldn’t display the code that was filled in specifically. I try to send xls files, csv files and sample charts. Thank you very much for your attention and help.
ChartData.csv (414 Bytes)
test cvdform.xlsx (10.7 KB)
Chart

1 Like

Welcome to the community, @dedik2urniawan! So there are possibly 8 possible outcomes where you have to display the image? And you will need to display the image that fits the case? Is this what you are trying to achieve?

Yes, it’s true like the scenario you said @Kal_Lam , so when the results of compiling the question variables later the results of the concatenate will become code which will later appear an image that matches the code. please guide and enlightenment, thank you for your attention.

Hi @dedik2urniawan
Having reviewed the last provided solution you referenced, I noticed an issue in the logic I had used. I would therefore recommend a different approach that does not use pull-data at all. The structure of the form will be as follows

I am attaching the XLS version of the form for your reference.

test cvdform_approach2.xlsx (18.2 KB)

Stephane

Stephane

1 Like

Thanks a lot @stephanealoo for the new formula approach to solve the problem with form screening, I tried to deploy using the xls formula reference you provided and delete the csv file (because the formula doesn’t use pulldata formula) and the result is like the following capture. the image still cannot be displayed in the form.

Hi @dedik2urniawan, I think this approach might not work as expected since Enketo pulls referenced images on page loading (at least in my testing). An alternative approach could be to do something like this:

If you have four images, blue_pill.png, red_pill.png, blue_ball.png and red_ball.png then you can display them variably with a relevant condition:

survey

type name label relevant media::image calculation
select_one colours colour Colour
select_one objects object Object
calculate image_name concat(${colour}, ‘_’, ${object})
note blue_pill ${image_name} = ‘blue_pill’ blue_pill.png
note red_pill ${image_name} = ‘red_pill’ red_pill.png
note blue_ball ${image_name} = ‘blue_ball’ blue_ball.png
note red_ball ${image_name} = ‘red_ball’ red_ball.png

choices

list_name name label
colours blue Blue
colours red Red
objects pill Pill
objects ball Ball
2 Likes

Incredibly, this approach is very successful and works as I expected. thanks a lot @Josh , so the variable approach has to use special variable types like object and color I’ve found the key. thank you, i hope you get a great favor on this day. big appreciate for solve it

1 Like

Hi @dedik2urniawan, sorry I missed this. I’m glad you managed to get it working :slightly_smiling_face: note that there isn’t anything special about the example with colours and objects – they were merely general things to show you how you can combine your own choices to see the same effect.

1 Like

Thank you @Josh for the response and help, from your instructions I got new knowledge about the flow of pull data for the selected image in addition to the addition of object and color variables but the syntax is relevant. thank you @Josh good day

2 Likes

I have the same problem. I want to extract images (Pictures) snapped together with the data. I want to work with it offline.

I’m taking records of C-19 Personnel and snapping them. Please assist me on how to download the details together with the pictures of personnel without missing or mixing them.