I want to show the total of the expenses, but I see that it does not add up the variables

As most items of the sum can be missing because they are filtered by relevant clauses, you may need to use number( coalesce(${p6211}, ‘0.0’) ) + …, and equally for all items in the sum. See ODK XForms Specification and ODK XForms Specification.
A corresponding formula would be if(${p6211} = ‘’. 0.0, ${p6211}) + if( …) + …

Hint: As decimals have limited IT accuracy, please, test the summation carefully, esp. with small numbers and many decimals.

Design hint:

  • I think the select_one sino should be required = true as you have a yes / no table here. (This is another reason for the need of the coalesce above, as the answers can be empty which are used later for the relevant).
  • These yes/no tables could also be designed as select_multiple. (Using relevant with selected(…)),
  • You don’t need to specify required = false, as this is the automatic default.

Your form has a syntax error: “The survey element named ‘Estamos_realizando_u_eriencia_al_respecto’ has no label or hint.” Don’t forget to check your forms during development and before deployment with the Online validator, please.

1 Like