Versions Compared

Key

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

...

Add a Hidden Value by clicking on the  in  in the Question Bar

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. 

...

  • 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.

...

  • Click on "edit" next to Calculate Condition
  • Click and hold on the question "How many living boys?" in the Question Tree and drag it into the Edit Expression (Advanced) box:

Image Modified

  • When you see the green check mark in the box you can release. CommCare will then translate that into the Question IDa blue question Reference:

Image Modified

You will notice that CommCare adds "/data/" before the QuestionID. The "data" is part of the system that CommCare uses to locate the data appropriately.  Whenever you reference any property or question in a calculate condition it must have /data/ in front of itcan hover your mouse over the reference and you can see details about the question.

  • Type "+" next to /data/the living_boys reference in the Expression Editor (Advanced Advanced ) box to indicate you want to add the value of that question
  • Click and hold on "How many living girls?" in the Question Tree and drag it over to the box until you see the green check mark:

Image Modified

  • Release and you will be able to see the full "XPath Expression":

Image Modified

  • You can now click "save" to store the expression and make sure you don't have any errors.


This is a simple expression so you should not see any error messages. After clicking "save" you should see your expression here:

Image Modified

Congratulations, you have successfully done your first Hidden Value calculation!

...