Calculating Age using Hidden Values

I am trying to use a Hidden Value to calculate age using today’s date and
the person’s date of birth in order to use for display conditions.

I have been trying to use int((today() - date(/data/dob)) div 365.25),
which I found on CommCare’s Help site, (in my app translates to
int((today() - date(/data/Registration/DOB)) div 365.25). I created a
Hidden Value called Age, however whenever I try to use Hidden Value in the
display condition for a question, the question simply doesn’t appear.

Any help would be much appreciated. Thank you!

Hi Natalia,

Have you been able to verify that the calculation is working as expected?
One thing you can to troubleshoot this is to create a label question and
display the value of the calculation (as described on
https://confluence.dimagi.com/display/commcarepublic/Display+an+Answer+to+a+Previous+Question).
You can delete the label question once you have confirmed that it is
working as expected and use the age hidden value in the display conditions.

Hope this helps!

Jeremy

··· On Fri, May 13, 2016 at 8:18 PM, Natalia Forbath wrote:

I am trying to use a Hidden Value to calculate age using today’s date and
the person’s date of birth in order to use for display conditions.

I have been trying to use int((today() - date(/data/dob)) div 365.25),
which I found on CommCare’s Help site, (in my app translates to
int((today() - date(/data/Registration/DOB)) div 365.25). I created a
Hidden Value called Age, however whenever I try to use Hidden Value in the
display condition for a question, the question simply doesn’t appear.

Any help would be much appreciated. Thank you!


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jeremy Wacksman
Dimagi http://www.dimagi.com, Inc.