Getting a missing value when adding multiple variable

Hello Sir,

I need an urgent help as i have stuck in using simple addition of more than 1 variable.

Like i have 5 variable but all five doesnt open everytime, it open when full fills a specific condition sometimes only 1 and sometimes more than 1 variable get open.

Now the issue is that, when all get open then the value of sum can be get, but when all are not opening the sum is missing,
secondly i tried to put default value of all of them to 0 while when i open the same app over the Enketo for testing it is working fine but in my android device it is not working.
Please suggest me how to do this.

In summation field use this calculation if(${variable1}='',0,${variable1})+...+if(${variable5}='',0,${variable5})

Thanking you so much sir,
for your valuable reply, though before I had used technique where i had put default value to 0 but you way still very efficient and conclusive.

Could you tell, as the odk is totally based on xml if i want to learn advance programming of odk what should i learn as i couldn't get any document for any advance programming and logic anywhere.

If you could answer , i would be grateful to you.

Basically ODK collect is the part of the ODK and ODK collect can read XML file.

Can you please be specific what you want to do by "advance programming":

ODK Collect customization?
XLS form development? XLS form development guideline
Server end customization?

Like before i used to develop my survey software in a software called CSPRO and java, in which it used to give me many kind of flexibility in terms of programming like:

From a repeat group , if there someone have specified 15 entries of different household member,
then by the programming in CSPRO we can get on those who are below 15 with all the details in a
popup menu anywhere in the programme.
Other is like , Loop condition, array variable, creating customized function and a lot more. I know sir ODK would also have all such thing, but I could not find any specific resource from where i could have understood and learn about these advance things.earn about these advance things.