Skip to main content
December 20, 2023
Solved

Comparing a value of date to Date & time

  • December 20, 2023
  • 2 replies
  • 1 view

Hello Team,

I have filter the date based on the function eomonth(today(),-1) i.e last day of previous month but the fitler has type of date & time where as this function will return only in date format.

I have tried to add the time to the function but couldnt able to achieve the requirement as it throwing error of miss comparison types.

please help.

Thanks in Advance.

Error : Expression evaluation error at function a!queryRecordType [line 3]: Cannot apply operator [LESS_EQUALS_THAN] to field [createdDate] when comparing to value [TypedValue[it=3,v=11/30/20236:08 AM]].

   

a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "createdDate" /* this is type of Date & Time */
          operator: "<=",
          value: concat(
            eomonth(today(), - 1),
            time(now())
            )
          
        ),
        
      },
      ignoreFiltersWithEmptyValues: true
    ),

Best answer by stefanhelzle0001

The concat() function turned the date and time values into a string. That will not work.

Instead, try to cast the date value into a datetime using the todatetime() function.

2 replies

stefanhelzle0001
December 20, 2023

The concat() function turned the date and time values into a string. That will not work.

Instead, try to cast the date value into a datetime using the todatetime() function.

hemap0003Author
December 20, 2023

Thanks a lot Stefan..

Your always my timesaviour [emoticon:c4563cd7d5574777a71c318021cbbcc8]