Calculate number of days between visits

A chw has to make two visits for patients on the selected form in the image below.

  • 1st visit does not occur immediately after registration
  • 2nd visit occurs 45 days after 1st visit
  • The close condition must be number of visits=2.

I have included three hidden values as illustrated in the image:

Numero_anterior_de_visitas = number of previous visits

Numero_ de_visitas = number of visits

Quarenta_ e_cinco_dias_da_primeira_visita = forty five days after first visit

Data_da_proxima_visita = next visit date

My problem is that the number of days from visit 1 to visit 2 is 0 in the view case detail list, but it should 45 so that the chw can see the date for the next visit. I think there may be something wrong with the expressions in the calculate conditions of the hidden values. Any help is welcome.

Thanks in advance.