Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let's revisit our Beginner's Tutorial form:

Image RemovedImage Added

Right now, we ask how many boys and girls are still alive that the woman gave birth to. However, let's say we also just want to have a way to reference the total number of children to determine the sum of the number of boys and girls. 

Add a Hidden Value by clicking on the Image Removed in the Question BarImage Removedselecting 'Add Question' and then selecting Hidden Value:

Image Added

Image Added

This should look familiar, but also a little bit different. Unlike all of the other question types, the Hidden Value only has a Question ID- no label text. This makes sense, because the user is not going to see anything so there is no need for text to be visible. 

The logic properties section has two boxes:By default, two properties are displayed:

  • Calculate Condition- this is something new! Instead of a validation condition, we have something that we can use to do complex calculations with the data collected in CommCare. We are going to primarily work with this part of the Hidden Value.
  • Question ID - this is an internal identifier for the question. This will be how the data is identified in any exports you perform. 

To add a display condition to the hidden value, we need to select the menu item in the top right hand corner of form builder and open the Logic Section:

Image Added

Display Condition- this is the same as in the other questions you have worked with. "Edit" opens the expression builder, or you can type directly in the box. To review the use of display conditions, see the Beginner Tutorial.
But what does it mean to put a "display condition" on something that is never displayed to the user? Great question! 

  • You can put a display condition in a hidden value
  • The hidden value will simply hold an empty value (i.e., be blank) until its display condition is met, regardless of the calculate condition.  Once its display condition is met, it holds the calculated (using the calculate condition) or loaded (using case management) value.

  • If you are using case management to update the case from a hidden value, it will only update the case if its display condition on the hidden value is met.
  • Calculate Condition- this is something new! Instead of a validation condition, we have something that we can use to do complex calculations with the data collected in CommCare. We are going to primarily work with this part of the Hidden Value.

 

Default Value - This field allows you to enter a preset value for the question. This will be the stored value by default unless otherwise altered. For example, you could choose to store a case property in this hidden value by default, and then use the calculate condition to update the value stored to the hidden value. 

Tip
titleDoes it matter where in the Question Tree the hidden value is?

It doesn't matter where you put a hidden value - it can be in the middle of a form or at the end and will not affect calculations or anything else.

 

...


Click on "Edit" next to Calculate Condition to see the following:

...