I am trying to come with a date validation that displays a certain message when reporting.
Scenario:
I have a question that asks "when was the last report sent?". This report is supposed to be sent between the 1st-5th of each month. So i want that when the date range is between those days, it dispalys a message that says "Timely Sent" otherwise display "Lately Sent".
Hi Kelvin,
It's a bit tricky, but that's how I do it
You will add a hidden value for the year and month of date of sending the report
for year: if(int(substr(your_date, 5, 7)) = 1, concat(int(substr(your_date, 0, 4)) - 1, "-"), substr(your_date, 0, 5))
for month: if(int(substr(your_date, 5, 7)) = 1, 12, int(substr(your_date, 5, 7)) - 1)
then for validation
. >= date(concat(year value, month value, "-01")) and .<=date(concat(year value, month value, "-05"))
Hello @Raneem,
Thank you for your help. But I just hve one question, the 'your_date' is a commcare function or I should replace that with an actual date i desire?