Adding the numbers

What is the problem? Please be detailed.

Q1. Does any of your son and daughter live with you?
option:
Yes..1
No...2--------> Q3

Q2a. How many son live with you?

Integer |_________|

Q2b. How many daughter live with you?

Integer |_________|

Q3. Does any of your son and daughter that you gave birth doesn't live with you?
option:
Yes..1
No...2-------->Q5

Q4a. How many son doesn't live with you?

Integer |_________|

Q4b. How many daughter doesn't live with you?

Integer |_________|

Q5. Does any of your son and daughter that they were born alive but later they were dead?
option:
Yes..1
No...2 ------->Q7

Q6a. How many son doesn't live with you?

Integer |_________|

Q6b. How many daughter doesn't live with you?

Integer |_________|

Q7. Add answer from 2a, 2b, 4a, 4b, 6a, 6b and display it

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 @sanish_shrestha

I think you use something like that:
test.xml (3.2 KB)
test.xlsx (6.8 KB)

More info about building forms you can find here: http://xlsform.org/

Regards,
Grzegorz

Hello @Grzesiek2010,

Yes that will be a solution given that he has selected all the options . But , if anyone is not selected it would show it as NaN . So before displaying it we have to either put that value as 0 or we should not display that value. To do either of them we have to add a calculate field or relevant condition respectively based upon the user requirement .

1 Like

@Grzesiek2010 But I wanna sum all those answer and display it, but when the question is skipped then the sum of total number is not displayed and when I enter all the answer of the question then only the sum of those answer is displayed.

${q2a} + ${2b} + ${4a} + ${4b} + ${6a} + ${6b} I did this in calculation but it doesn't work when the question is skipped

@sanish_shrestha

check out this: test.xlsx (7.0 KB)

2 Likes

@Grzesiek2010 Thank you. It helped me