Calculate response

Hello, I want to concatenate answers to show theme in a calculation field.
I've CauseOfDeath (yes, No)
if yes meaning cause_diagnosed ==> CategorieOfCause( Disease, Accident, Crime, Unknown)
if one select Disease there are many choices: Disease( Malaria, Pneumonia, .....)
if one select Accident there are many choices: Accident( Car, Fire, Mooto, .....)

If No meaning cause_of_death_not_diagnosed ==> Unknown...

How to calculate the selected response depending in Yes or No?

1 Like

hi @abdoul, am not clear with what you presented. if you want the calculation to concatenate the cause and causeofdeathnotdiagnosed, your [concat(${cause}, ${causeofdeathnotdiagnosed})] calculation will produce this causecauseofdeathnotdiagnosed. if you want to have space between the two you can do that with this. concat(${cause}, ' ', ${causeofdeathnotdiagnosed})

also, if you want the concatenation to be dependent on the the Yes or No answer option, then you can use a relevance on the calculated file.

your field type is text this means your calculation will be shown on a text field with the chance for you to educate it. i have not try it though. but to have the concatenate work on a calculation to be called on subsequent question then you need to have a field type calculate to be able to call that up.



Hello, Fabla thanks for your quick answer. let explain it in details again.

concat(${cause}, ${causeofdeathnotdiagnosed})

there a YES/NO question id it's the YES, in the field of calculation only the result of ${cause} will appear.
In this Cause, there is another categories ( Disease, Accident, Crime, Unknown).
Now if the respondant choose randomly one it should be the result in the concatenated field.

So this

concat(${cause}, ${causeofdeathnotdiagnosed})
calculation I wwanted to replace it by

concat(${Disease}or ${Accident} or ${Crime} or ${Unknown} or {causeofdeathnotdiagnosed})

When I've tested it, I got TRUE as resulte in ODK collect :smile:

if you still don't understand toomorow I'll send you the xls file. it's at office's desktop.

that will be great.
and also give a naration on each question what you intend to get when an answer option is chosen.

Ok, I'll. Thanks again.

Hello @Fabla this is the file death_registration.xlsx (13.7 KB) .
In survey tab, your'll find in red and blue color the answer that I want to apear in calculation field. If you click in tab choice there's the different kind of categories of any attributes which are in survey.

Thanks in advance

Hi @abdoul, i have looked at you sample file and i have come out with this, i don't know if it is what you are looking for. please test this and let us know if it is what you are looking for.

Death_registration_review.xml (14.4 KB)
Death_registration_review.xlsx (278.5 KB)



Thanks, let me try to see what'll be the result.