Skip to main content
July 9, 2024
Question

Compare datetime field with date(Fetch Duplicate request)

  • July 9, 2024
  • 2 replies
  • 0 views

I have a datetime field in DB. When user selects datetime from interface, i want to make sure that date doesn't already exist in DB. Basically, i am trying to fetch duplicate requests for a day. 

I cannot use "=" operator since field is of datetime type not date and if i use other operators such as startswith, in, includes , it gives me error i.e. Cannot apply operator [INCLUDES] to field [dateTime] when comparing to value [TypedValue[it=9,v=2024-07-05 05:00:00.0]].

    2 replies

    July 9, 2024
    Option - 1: If you are using Record Type, you can create a custom field using your existing field. Then, you can make a query on this new custom field.
    Option - 2: Use Between operator
    venkatrea696188
    July 9, 2024
    i want to make sure that date doesn't already exist in DB. Basically, i am trying to fetch duplicate requests for a day

    And how you are comparing?? Querying data after user enters value on interface or Comparing with already fetched data?? . If you are going with first one the both approaches suggested by Yogi would work.

    If it's second one just wrapping todate() around variable will do the work.