How to effectively display calculation in ODK

What is the problem? Please be detailed.

I have used calculate to obtain the number of F_missed on a row then the next row number of M_missed then Total_missed which is the addition of the two. but if one of the result evaluate to zero it does not show under display the ${Total_missed} is. How do i resolve this?

What ODK tool and version are you using? And on what device and operating system version?
What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi @fathy

could you attach an example form?

sample.xlsx (12.0 KB)
please see attached


I tried to figured out the issue you reported and even built a sample form: calculations.xls (6.5 KB)

but everything looks ok to me... could you describe the issue better or maybe provide exact steps I should follow?

many thanks @Grzesiek2010

Using the sample form you shared, the issue is if either c1 or c2 is zero (0) then the final result c3 will not display the value it is holding on the smartphone.

Also, if c1 is the one evaluating to zero it will not show on the smartphone. so c1 and c3 will not display the values they are holding
let me know if additional information is required.

so my sample form is ok and you are able to reproduce the issue using that form? That would be strange because I'm not.
Please take a look at my steps and let me know what I am doing wrong:

1 Like

I am attaching the sample form for your view and inputs. The issues are

  1. display_msd3 does not display on screen if ${Tot_missed}=0
  2. ${Tot_Missed} will not display it content if either of F_missed or M_missed is 0 in display_msd4sample_form.xlsx (14.9 KB)

Kindly help to review but i will be on stand by if additional information is required.

Can't convert your xlsx file - no choices sheet. Couldn't you prepare a smaller form just for showing your problem? It's much easier if such a form contains only needed questions.

sample_form.xlsx (11.5 KB)

Thanks pls see attached.


Trust you are helping on the issue. I sent a lengthy form because the problem might be from previous questions.


Your problem is that you use question Vaccinated2F and Vaccinated2M for calculations in question F_missed and M_missed but those first two questions might not be relevant. If they are not relevant the value is null not 0 as you probably assumed, so then in
F_missed you try to calculate ${F_eligible}- ${Vaccinated1F} - null
and in M_missed
${M_eligible} - ${Vaccinated1M} - null
what causes problems.
To fix the problem you need to use:
${F_eligible}- ${Vaccinated1F} - (if(${Vaccinated2F}=null, '0', ${Vaccinated2F})) for F_missed
${M_eligible} - ${Vaccinated1M} - (if(${Vaccinated2M}=null, '0', ${Vaccinated2M})) for M_missed


You are a genius. When i grow up i will like to be a genius like u. Regards