Age calculation not correct?

66 views
Skip to first unread message

James Tinkamanyire

unread,
Mar 16, 2015, 4:34:08 PM3/16/15
to commcar...@googlegroups.com
Hi CommCare Users,

I have a hidden value that calculates the age of subject depending on what date date of birth is entered by a health worker. Dates >= 01/01/1970 display the correct age but dates before that Unix time do no return the correct calculation. Consequently, the app flow is greatly affected. I used this formula to calculate age: 
  • Age in years: int((today() - date(/data/dob)) div 365.25)
If I enter DOB as for example 01/01/1965, the calculation is not displayed, could someone please help me out?

Thanks,
James

Phillip Mates

unread,
Mar 16, 2015, 5:23:32 PM3/16/15
to commcar...@googlegroups.com
Hi James,

I tried to replicate the problem you've described on my phone and was unable to. Using your formula I was able to correctly calculate age values pre-Unix epoch. Did you try testing your form in Cloudcare?

If you believe it is a bug, will you please report it on CommCare HQ via the "Report an Issue"? Be sure to provide as much context as possible to enable us to reconstruct your problem.

Thanks,
Phillip

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Tinkamanyire

unread,
Mar 17, 2015, 1:55:00 PM3/17/15
to commcar...@googlegroups.com, Jessica Haberer, Ashaba Justus, akembabazi2005, Lauren Fox, Sarah Hodsdon
Hi Phillips,

Thanks for prompt response. I just tested the form in CloudCare but still no desired result. I have attached 2 screenshots with DOB pre-Unix Epoch and DOB post-unix Epoch. Do you mind taking a look, please?

I am going to report a bug via the CommCare mobile tool as well.

Thanks,
James

--
You received this message because you are subscribed to a topic in the Google Groups "commcare-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/commcare-users/UuuwCJFWGQo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to commcare-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------
James Tinkamanyire | Data Manager
Measuring Early Treatment Adherence - META Project
Global Health Collaborative - MUST - Uganda

P.O. Box 1397, Mbarara.

BSc Computer Engineering
MBARARA UNIVERSITY OF SCIENCE & TECHNOLOGY
P.O. Box 1410, Mbarara, Uganda.

Mobile Tel: +256 (0)702 864 964
Skype: jimmyjaymes1


Age Calc equal to Unix Epoch Time.PNG
Age Calculation.PNG

Clayton Sims

unread,
Mar 18, 2015, 5:36:07 PM3/18/15
to commcare-users, Jessica Haberer, Ashaba Justus, akembabazi2005, Lauren Fox, Sarah Hodsdon
James,

This calculation is currently working for me in a test form that I've attached (the age/dob calculation was copied and pasted from yours). Can you confirm whether this form replicates the same behavior you're seeing in cloudcare?

-Clayton
Date One Liners.xml

James Tinkamanyire

unread,
Mar 18, 2015, 6:39:06 PM3/18/15
to commcar...@googlegroups.com, Jessica Haberer, Ashaba Justus, akembabazi2005, Lauren Fox, Sarah Hodsdon
Hi Clayton,

I see that your test form is in an xml file but I am unable to view it's content. I have tried diff DOBs several times on CloudCare and on CommCare mobile but I still do not get a similar output as I expect if the DOB is pre-Unix Epoch and when it's after. Did you look at the two test forms I attached? 

Thank you,
James

Sanu Ghalan

unread,
Mar 18, 2015, 8:43:07 PM3/18/15
to commcar...@googlegroups.com, Jessica Haberer, Ashaba Justus, akembabazi2005, Lauren Fox, Sarah Hodsdon
Hi commcare users

Can you share me about fixture. Can we monitor to our mobile worker by fixture option?
Reply all
Reply to author
Forward
0 new messages