Skip to main content
February 3, 2023
Question

Issue while fetching date from query rule

  • February 3, 2023
  • 6 replies
  • 0 views

In DB I have some records with only Date and some records with date& time

Example:

2/1/2023 1:22:31 PM

10/17/2023

11/15/2023

7/07/2022

6/17/2022  2:22:32 AM

11/17/2022

9/28/2022

9/28/2022

i need to filter it out with only date but where ever time records available those records unable to filter it out

a!queryFilter(
field: "date",
operator: "=",
value: ri!date
)

can someone help me with this

    6 replies

    gayathris111098
    February 3, 2023

    What is the Column type for that column?

    February 3, 2023

    Datatype :DATE

    gayathris111098
    February 3, 2023

    You can not save date and time on data type field. Can you share us more details on DB structure and values?

    February 3, 2023

    I have a filter for dateTime and it works fine:

    a!queryFilter(
    applyWhen: not(isnull(ri!requestsNewerThan)),
    field: "createdOn",
    operator: ">",
    value: ri!requestsNewerThan
    )

    I would say that the rule input and filtered field both need to be date/datetime).

    konduruc733182
    February 3, 2023

    can you try adding these filters to your rule and check if it helps

    {
    a!queryFilter(
      field: "date",
      operator: ">=",
      value: todatetime(ri!date)
    ),
    a!queryFilter(
      field: "date",
      operator: "<=",
      value: todatetime(ri!date)+1
    )
    }

    abhayd3663
    February 12, 2023

    First of all, DB won't allow to save DATETIME value in DB when the column type is DATE.