I would like to know how to handle cases where a precise birthdate isn’t known at all in a tracker registration form. (especially older people often don’t know their exact birthdates). If possible, I would like to capture an estimated age and then have a date of birth be calculated based on this.
As Abyot stated, using the “Age” value type does work great for calculating the date of birth from the age (either months years or days, none are compulsory) and you don’t need a formula. You just need to change the value type of your “Date of birth” attribute from “date” to “age”
If I remember correctly there are some issues with using this in some versions of DHIS2 ( For example, when using a format different than YYYY-MM-DD, will update the post when I find the right Jira with the limitations)
Edit: here are the Jira tickets: Log in - DHIS 2 JIRA (unresolved) Log in - DHIS 2 JIRA (fixed for 2.34 onwards)
How to add a checkbox: You will need to create an attribute that is “yes only” and add it to your program attributes
If you don’t use the Age value type and instead do this straight from an attribute where the age is stored in years, you will have to create a series of programme rules. Here is a good example (Using add d2:addDays)