Display Condition Using Dates

Hello Everyone,

I am a student in an mHealth class at Boston University’s School of Public
Health and am working on developing an Early Childhood Development module.
My team members and I have created several age-specific forms with display
conditions based upon the ages they are designed for. In other words, we
would only like the form that is particular to a case’s age to be available
for completion.

The following code is being used to display a form only when the child is
between 3 and 4 months of age (using an adjusted date of birth):

((./adjusted_dob < date(today()-91)) and (./adjusted_dob >
date((today()-121))))

We are able to run the app without any errors but the screening forms are
not showing up. We believe that there may be an error in our display
conditions, but are not completely sure. Any input or feedback would be
greatly appreciated. Thanks!

Justin

Hi Justin,

Thanks for writing in. The gist of your logic looks good to me - there’s
one technical issue that might be causing your troubles.

When you save questions to the case as case properties, the value is always
saved as text (a “string”). Even if the original question was a date, or
an integer, or GPS coordinates, when you save it to the case it turns into
a text value.

This means when you use case properties in logic, either in form display
conditions, case filters, or after loading them into a form, they are text
values. You can convert the text value into a date value by using the
"date" function (See
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-FormattingConversionFunctions
)

In your form display condition, try using date(./adjusted_dob) in place of
./adjusted_dob.

Hope this helps!

Amelia

··· On Sun, Apr 21, 2013 at 1:35 PM, wrote:

Hello Everyone,

I am a student in an mHealth class at Boston University’s School of Public
Health and am working on developing an Early Childhood Development module.
My team members and I have created several age-specific forms with display
conditions based upon the ages they are designed for. In other words, we
would only like the form that is particular to a case’s age to be available
for completion.

The following code is being used to display a form only when the child is
between 3 and 4 months of age (using an adjusted date of birth):

((./adjusted_dob < date(today()-91)) and (./adjusted_dob >
date((today()-121))))

We are able to run the app without any errors but the screening forms are
not showing up. We believe that there may be an error in our display
conditions, but are not completely sure. Any input or feedback would be
greatly appreciated. Thanks!

Justin


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/groups/opt_out.

Hi Justin-

It is fantastic that you are working on a module using CommCare for ECD. I have been involved in developing integrated packages for ECD interventions (e.g., Essential Package for ECD and HIV) and I am currently working with a couple of organizations exploring how these integrated packages can be best operationalized using mobile technology, specifically decision algorithms. I would be very interested to know about the content you are using for the module and how you are organizing such content. Since this is not directly related to the technology, feel free to contact me directly at wcphilbrick@gmail.com).

Thanks!

Bill Philbrick

··· On Apr 21, 2013, at 1:35 PM, jmaly@bu.edu wrote:

Hello Everyone,

I am a student in an mHealth class at Boston University’s School of Public Health and am working on developing an Early Childhood Development module. My team members and I have created several age-specific forms with display conditions based upon the ages they are designed for. In other words, we would only like the form that is particular to a case’s age to be available for completion.

The following code is being used to display a form only when the child is between 3 and 4 months of age (using an adjusted date of birth):
((./adjusted_dob < date(today()-91)) and (./adjusted_dob > date((today()-121))))

We are able to run the app without any errors but the screening forms are not showing up. We believe that there may be an error in our display conditions, but are not completely sure. Any input or feedback would be greatly appreciated. Thanks!

Justin


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/groups/opt_out.