# Sum for skipping question, Select one default and Group relevant

Dear all, I have three problems that need all of you help to fix

1. I could not sum value for skipping question
e.g. I have 3 questions ask about income and those 3 questions have
parent questions.
Then I will calculate Total= \${Q1.1} + \${Q2.1} + \${Q3.1}
But in case among which one, both, or all question has skipped, it
could not calculate the total. Even though I set the default value to those
variable. It still could not calculate

2. I want to set default for select one question based on conditions
e.g. If Total of income >=300, \${fieldname}='yes'
else \${fieldname}='no'
I used this formula
*if(\${total_income}>=300, selected\${select_income},'1') *This
formula could not meet with else condition. So how can I do?

3. I want to use relevant for group based on three conditions
e.g. If meet with this condition below, it will show group. And else,
it will hide. I used this formula. That is correct?
selected(\${fieldname},'0') and selected(\${fieldname},'0') and
selected(\${fieldname},'0')

Best,
Lihol

Lihol,

1. Have a default on the skipped questions to be zero. Also, adjust
the total formula so skipped questions return 0 if blank. This is
untested, but it'd be something like:
if(string-length(\${q1})=0,'0',\${q1})

2. Test to make sure, but I don't think you can set conditional
defaults in Collect. You can store conditional values though. Put a
calculate on \$fieldname: if(\${total_income}>=300,'yes,'no')

3. If you want the group to show if all three are true, then yes, that
will work.

Yaw

ยทยทยท -- Need ODK consultants? Nafundi provides form design, server setup, in-field training, and software development for ODK. Go to https://nafundi.com to get started.

On Thu, Jun 30, 2016 at 10:28 AM, Srou Lihol sroulihol@gmail.com wrote:

Dear all, I have three problems that need all of you help to fix

1. I could not sum value for skipping question
e.g. I have 3 questions ask about income and those 3 questions have
parent questions.
Then I will calculate Total= \${Q1.1} + \${Q2.1} + \${Q3.1}
But in case among which one, both, or all question has skipped, it
could not calculate the total. Even though I set the default value to those
variable. It still could not calculate

2. I want to set default for select one question based on conditions
e.g. If Total of income >=300, \${fieldname}='yes'
else \${fieldname}='no'
I used this formula if(\${total_income}>=300,
selected\${select_income},'1')
This formula could not meet with else condition. So how can I do?

3. I want to use relevant for group based on three conditions
e.g. If meet with this condition below, it will show group. And else, it
will hide. I used this formula. That is correct?
selected(\${fieldname},'0') and selected(\${fieldname},'0') and
selected(\${fieldname},'0')