Case List Display message based on Date

I am using Commcare to track pregnant women to improve ANC and PNC check
ups. Based on LMP dates entered, certain messages are displayed under case
list to an user so that they can remind a pregnant women about health
facility visit. My assumption was message will change if it meets the
criteria automatically, For example, I am using following code to display
appropriate message under case list. If the difference between now() and
delivery date is equal to or greater than three then display *Follow up for
3rd day PNC visit. * If difference between now() and delivery date is less
then three then display *Not yet due for 3rd day PNC visit. *This is
working fine to display message.

if(now() - date(/data/baby_delivery_date)) >= 3, “Follow up for 3rd day
PNC visit.”, “Not yet due for 3rd day PNC visit.”)

This is working fine if it meets criteria the day data is entered.However,
what I am trying to do is change *Not yet due for 3rd day PNC visit *
message to *Follow up for 3rd day PNC visit *as soon difference between
now() and delivery date is equal to three.

Is it possible to do it? Any help is highly appreciated.

Thank you.

Anybody?

··· On Tuesday, June 14, 2016 at 2:08:32 PM UTC+5:45, Bibek Adhikari wrote: > > I am using Commcare to track pregnant women to improve ANC and PNC check > ups. Based on LMP dates entered, certain messages are displayed under case > list to an user so that they can remind a pregnant women about health > facility visit. My assumption was message will change if it meets the > criteria automatically, For example, I am using following code to display > appropriate message under case list. If the difference between now() and > delivery date is equal to or greater than three then display *Follow up > for 3rd day PNC visit. * If difference between now() and delivery date is > less then three then display *Not yet due for 3rd day PNC visit. *This is > working fine to display message. > > *if(now() - date(/data/baby_delivery_date)) >= 3, "Follow up for 3rd day > PNC visit.", "Not yet due for 3rd day PNC visit.")* > > This is working fine if it meets criteria the day data is entered.However, > what I am trying to do is change *Not yet due for 3rd day PNC visit * > message to *Follow up for 3rd day PNC visit *as soon difference between > now() and delivery date is equal to three. > > Is it possible to do it? Any help is highly appreciated. > > Thank you. >

Bibek,

I’m not sure I understand your issue, can you clarify something for me? Is
the problem that the followup isn’t changing with the date?

You are actually setting a String value directly into the case with this
expression, which is why it isn’t changing with the time?

One option would be to save the value of

date(/data/baby_delivery_date)

to the case instead, and then use the Late Flag format for displaying
that value in the case list. The Late Flag causes an item to appear on
the case list when now() - DATE has crossed a certain number of days, so
that sounds like it would meet your use case exactly.

-Clayton

··· On Tue, Jun 14, 2016 at 10:47 AM, Bibek Adhikari wrote:

Anybody?

On Tuesday, June 14, 2016 at 2:08:32 PM UTC+5:45, Bibek Adhikari wrote:

I am using Commcare to track pregnant women to improve ANC and PNC check
ups. Based on LMP dates entered, certain messages are displayed under case
list to an user so that they can remind a pregnant women about health
facility visit. My assumption was message will change if it meets the
criteria automatically, For example, I am using following code to display
appropriate message under case list. If the difference between now() and
delivery date is equal to or greater than three then display *Follow up
for 3rd day PNC visit. * If difference between now() and delivery date
is less then three then display *Not yet due for 3rd day PNC visit. *This
is working fine to display message.

if(now() - date(/data/baby_delivery_date)) >= 3, “Follow up for 3rd day
PNC visit.”, “Not yet due for 3rd day PNC visit.”)

This is working fine if it meets criteria the day data is
entered.However, what I am trying to do is change *Not yet due for 3rd
day PNC visit *message to *Follow up for 3rd day PNC visit *as soon
difference between now() and delivery date is equal to three.

Is it possible to do it? Any help is highly 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.

Hi Clayton:

Yes, “Not yet…” is not changing to “Follow up” after if condition is met
(date difference between baby_delivery_date and now. What I am trying to do
is, an user looks at the case list everyday and makes a plan to visit new
mother to remind her for PNC check up (24hrs, 3rd day, 7th day and 42nd
day). This is based on baby delivery date.

Does this help?

Hope to hear from you, thank you.

··· On Tuesday, June 14, 2016 at 8:45:46 PM UTC+5:45, Clayton Sims wrote: > > Bibek, > > I'm not sure I understand your issue, can you clarify something for me? Is > the problem that the followup isn't changing with the date? > > You are actually setting a String value directly into the case with this > expression, which is why it isn't changing with the time? > > One option would be to save the value of > > *date(/data/baby_delivery_date)* > > to the case instead, and then use the *Late Flag* format for displaying > that value in the case list. The *Late Flag* causes an item to appear on > the case list when now() - DATE has crossed a certain number of days, so > that sounds like it would meet your use case exactly. > > -Clayton > > On Tue, Jun 14, 2016 at 10:47 AM, Bibek Adhikari <bibeka...@gmail.com > wrote: > >> Anybody? >> >> >> On Tuesday, June 14, 2016 at 2:08:32 PM UTC+5:45, Bibek Adhikari wrote: >>> >>> I am using Commcare to track pregnant women to improve ANC and PNC check >>> ups. Based on LMP dates entered, certain messages are displayed under case >>> list to an user so that they can remind a pregnant women about health >>> facility visit. My assumption was message will change if it meets the >>> criteria automatically, For example, I am using following code to display >>> appropriate message under case list. If the difference between now() and >>> delivery date is equal to or greater than three then display *Follow up >>> for 3rd day PNC visit. * If difference between now() and delivery date >>> is less then three then display *Not yet due for 3rd day PNC visit. *This >>> is working fine to display message. >>> >>> *if(now() - date(/data/baby_delivery_date)) >= 3, "Follow up for 3rd day >>> PNC visit.", "Not yet due for 3rd day PNC visit.")* >>> >>> This is working fine if it meets criteria the day data is >>> entered.However, what I am trying to do is change *Not yet due for 3rd >>> day PNC visit *message to *Follow up for 3rd day PNC visit *as soon >>> difference between now() and delivery date is equal to three. >>> >>> Is it possible to do it? Any help is highly 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Bibek,

That does make sense.

Unfortunately when you save the value to the case, you save the value
itself, not the calculation, which is why it’s not updating.

If you instead saved */data/baby_delivery_date *to the case you can then
refer to that date in the case list and set the type to Late Flag you can
make a flag appear when the date is past a certain number of days.

-Clayton

··· On Tue, Jun 14, 2016 at 11:21 AM, Bibek Adhikari wrote:

Hi Clayton:

Yes, “Not yet…” is not changing to “Follow up” after if condition is met
(date difference between baby_delivery_date and now. What I am trying to do
is, an user looks at the case list everyday and makes a plan to visit new
mother to remind her for PNC check up (24hrs, 3rd day, 7th day and 42nd
day). This is based on baby delivery date.

Does this help?

Hope to hear from you, thank you.

On Tuesday, June 14, 2016 at 8:45:46 PM UTC+5:45, Clayton Sims wrote:

Bibek,

I’m not sure I understand your issue, can you clarify something for me?
Is the problem that the followup isn’t changing with the date?

You are actually setting a String value directly into the case with this
expression, which is why it isn’t changing with the time?

One option would be to save the value of

date(/data/baby_delivery_date)

to the case instead, and then use the Late Flag format for displaying
that value in the case list. The Late Flag causes an item to appear on
the case list when now() - DATE has crossed a certain number of days, so
that sounds like it would meet your use case exactly.

-Clayton

On Tue, Jun 14, 2016 at 10:47 AM, Bibek Adhikari bibeka...@gmail.com wrote:

Anybody?

On Tuesday, June 14, 2016 at 2:08:32 PM UTC+5:45, Bibek Adhikari wrote:

I am using Commcare to track pregnant women to improve ANC and PNC
check ups. Based on LMP dates entered, certain messages are displayed under
case list to an user so that they can remind a pregnant women about health
facility visit. My assumption was message will change if it meets the
criteria automatically, For example, I am using following code to display
appropriate message under case list. If the difference between now() and
delivery date is equal to or greater than three then display *Follow
up for 3rd day PNC visit. * If difference between now() and delivery
date is less then three then display *Not yet due for 3rd day PNC
visit. *This is working fine to display message.

if(now() - date(/data/baby_delivery_date)) >= 3, “Follow up for 3rd
day PNC visit.”, “Not yet due for 3rd day PNC visit.”)

This is working fine if it meets criteria the day data is
entered.However, what I am trying to do is change *Not yet due for 3rd
day PNC visit *message to *Follow up for 3rd day PNC visit *as soon
difference between now() and delivery date is equal to three.

Is it possible to do it? Any help is highly 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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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.