Form display condition based on date

Can any help me how to display different Forms based on date.

I have one registration form and three follow up forms i have linked date of screened from registration form to all followup forms. using this variable i need to display followup 1 after 10 days of screened date and followup 2 in 25 days and followup 3 in 33 days.

The structure of my app is like this

Registration
Follow up
Form 1- visible after 7 days of screened date.
Form 2 - visible after 21 days of screened date
Form 3- visible after 28 days of screened date

Hi Tewelde,

You can solve this by configuring display conditions for your follow-up forms based on the date ranges you describe above: check out this wiki page for instructions.

For the display condition itself, it sounds like you've already saved your date of registration/screening as a case property on your patient/client case - if not, definitely start there. Then you can use that case property (i'm calling it 'date_of_registration' below) to calculate the follow-up dates directly in the form display condition and display to the user based on the relationship between today's date and your screening date, i.e.

-display condition for follow up form 1: date(today()) >= date(./date_of_registration + 7)
-for follow up form 2: date(today()) >= date(./date_of_registration + 21)

Alternately (and probably better, though a little more initial setup), you can calculate and save the follow-up due-dates as case properties to your patient/client case as well and then reference these in the form display condition, because having these dates on your case will likely be useful in other contexts.

For example, keep a hidden value in your registration form called date_first_follow_up_due that calculates date(today() + 7), and two others that calculate your 2nd and 3rd followup dates. Save these dates as case properties on your patient/client case. Your form display condition on follow up form #1 would then be something like date(today()) >= date(./date_first_follow_up_due). Then follow suit with display conditions your 2nd and 3rd follow-up forms, referencing their respective date-due properties.

Good luck!

Best
Jordan

Thank you very much Jordan.

I will do accordingly.

I have variable date of enrollment in the registration form and in order to link enrollment data to FU1,FU2,FU3 data i created hidden variable in each follow up forms and i call #case/E_date in the default value of hidden vaiable called E_date. Do you think i will see date of enrollment in all follow up forms ?

Hi Tewelde,

If you've saved the case property E_date in the enrolment form, you could
then load the property into the followup forms and display it to the user
via a label. You may find these case management tutorials to be good
resources if you haven't yet used them: check out
https://confluence.dimagi.com/display/commcarepublic/Basic+Case+Management+Tutorial
as
a start. There's also more info about followup forms linked there that may
be helpful.

Good luck!

Best
Jordan