15
Views
3
Comments
Filter appointments
Application Type
Mobile
Service Studio Version
11.55.32 (Build 64283)
Platform Version
11.37.0 (Build 45622)

"Há um erro '=' ocorrendo no filtro da minha consulta. O que pode estar causando isso?"


2026-01-28 16-57-48
Mihai Melencu
Champion

Hi @Mário Pombal ,

I copied your expression, but got another error:

Cannot apply '-' operator to 'Date' together with 'Integer'.

The error was on these lines:  In OutSystems, CurrDate() gives you a date value, and you can’t just do “date – number” to subtract days.  You have to use the built-in date functions instead, for example: 

AddDays(CurrDate(), -3)

The final expression would be:

  • (  
  •   FiltroDataSelecionado = "HOJE"  
  •   and  
  •   Appointment.Date = CurrDate()  
  • )  
  • or  
  • (  
  •   FiltroDataSelecionado = "SEMANA"  
  •   and  
  •   Appointment.Date >= AddDays(CurrDate(), - ( DayOfWeek(CurrDate()) - 2))  
  •   and  
  •   Appointment.Date <= AddDays( CurrDate(),  8 - DayOfWeek(CurrDate()))  
  • )  
  • or  
  • (  
  •   FiltroDataSelecionado = "MÊS"  
  •   and  
  •   Month(Appointment.Date) = Month(CurrDate())  
  •   and  
  •   Year(Appointment.Date)  = Year(CurrDate())  
  • )
2025-08-20 23-33-02
Mário Pombal

The error persists

2023-11-14 07-36-16
Yung Shin

Hi Mario,

Can I check if your Appointment.Date is Date but not DateTime? If that is the case, here is the revised answer from Mihai.

  • (FiltroDataSelecionado = "HOJE"    and    Appointment.Date = CurrDate()  )  
  • or 
  • (FiltroDataSelecionado = "SEMANA"    and    Appointment.Date >= DateTimeToDate(AddDays(CurrDate(), - ( DayOfWeek(CurrDate()) - 2)))    and    Appointment.Date <= DateTimeToDate(AddDays( CurrDate(),  8 - DayOfWeek(CurrDate()))))  
  • or  
  • (FiltroDataSelecionado = "MÊS"    and    Month(Appointment.Date) = Month(CurrDate())    and    Year(Appointment.Date)  = Year(CurrDate()) )
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.