Constraint on Date using pulled data


I am trying to calculate new age of child using the pulled data on date of birth.

I have a “note” question which displays the Date of Birth

  1. Can I calculate the age using "today() - ${note} ?

  2. If that is not possible, I can ask the enumerator to enter the date of birth given in the “note” into a calendar. But for that I will need to set a constraint that the entered date is equal to the date displayed in the note. How should I set this constraint?

The objective is to calculate age of child on each monthly household visit using the date of birth provided in the baseline.

If anyone has any ideas, please let me know!

Hi guys,

So I just figured out the code and thought to share it with everyone for future reference. The idea is to match the date format of the two dates - one given in the note and the other entered into calendar.

My date displayed in a note (pulled from the CSV) was, for example: Jun 06, 2018 and this is the code I used to match the calendar date with the one in my note:

(format-date(${date_calendar},’%b %d, %Y’)) = (${date_note})

1 Like

I add this code in the ‘constraint’ for calendar date entered by the enumerator.

1 Like

Hi @mahrukhkhan,

Thanks for sharing your knowledge and skills with the entire community!