Community Health Toolkit

Cannot set date value based on calculation

I have a date field and I need to set a value based on a calculate field.

the calculate field simply depends on a yes/no question. If the answer is yes, a previously recorded date value is set, else set empty string and let the user pick a date.

However, I noticed that when the answer is yes, the calculate field doesn’t set the date value. Here’s the link of the form:

Hi Iesmail,

The type of the field that is calculated should be set to ‘calculate’. With the current setting of ‘date’, it will prompt the user for a date input.

I tested the form and it seems to work as you were hoping to. Have you resolved your problem? If not, perhaps you can show with a screenshot what you’d expect vs what you are experiencing.

Here is what I see:

Also, just to note that you can choose to show the date input box only when it is needed by adding a condition to the relevant column.

@marc , I forgot to add the relevancy condition which is the actual cause of the issue.

This is what I used as a relevancy condition: selected(${does_client_know_date},"no")

Ah great, so you’ve got it working as desired now?

Not really. Still stuck on it.

@iesmail Seems you may have flipped the logic in your calculation condition. The relevance condition expects ${does_client_know_date} = "no" but your calculation expects ${does_client_know_date} = "yes". If you switch the calculation to have ${does_client_know_date} = "no" you’ll have the payment date prefilled.