# Having difficulty configuring days in the case list

Hi, everyone.

In my application. I register patients as either apoio ou reintegração: apoio ou reintegração are types of patients.

A patient registered as apoio receives 2nd visit 56 days after first visit.

A patient registered as reintegração receives 2nd visit 45 days after first visit.

A patient registered as apoio can after some time change to reintegração and if this change occurs I want the application to show the correct number of days. In the image bellow I have register first Agira Chitsipa as apoio and it shows that the 2nd visit will be after 56 days, but when Agira Chitsipa changes to reintegração, it still shows 56 days and not 45 days.

Iam looking for ideas and any suggestions on how I can configure this are welcome

Hi Ferdinand,

What is the property or calculation you have in the “Próxima Visita” column? My understanding is that it should be something like cond(caso = “Apoio”, 56, caso=“Reintegração”,45,0), does that makes sense? Considering that caso is the name of the property

Hi, Avazirna.

I have two hidden values that calculate the number of days for the second visit for each caso as follows:
Apoio:Data da proxima visita (next visit date): if(format-date(date(today() + 56), “%a”) = “Sun” or format-date(date(today() + 56), “%a”) = “Sat”, date(today() + 58), date(today() + 56))

reintegracao: Data da proxima visita(next visit date) if(format-date(date(today() + 45), “%a”) = “Sun” or format-date(date(today() + 45), “%a”) = “Sat”, date(today() + 47), date(today() + 45))

I have configured the case list as in the image below:

What I would like to happen is that when a patient changes from apoio to reintegracao or vice-versa, the app shows the correct number of days for the 2nd visit. How would the expression combination be using the cond function as you suggested above so that the correct configuration is displayed in the case list?