Query to search a date in date range is not working

Hi,

I an trying to filter records from DB where selected date is between startDate & endDate in the query below but for some reason I am not getting any result, please help me with it.

Expression Rule:

a!localVariables(
  local!sampleData: a!queryEntity(
    entity: cons!DATA,
    query: a!query(
      logicalexpression: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: "userid",
            operator: "=",
            value: ri!userid
          ),
          a!queryFilter(
            field: "startdatetime",
            operator: ">=",
            value: gmt(todate(ri!selectedDate)),
            applyWhen: not(isnull(ri!selectedDate))
          ),
          a!queryFilter(
            field: "enddatetime",
            operator: "<=",
            value: gmt(todate(ri!selectedDate)),
            applyWhen: not(isnull(ri!selectedDate))
          )
        },
        ignoreFiltersWithEmptyValues: true
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(field: "createddate", ascending: true)
      )
    ),
    fetchTotalCount: false
  ).data,
  {
    if(
      not(isnull(local!sampleData)),
      local!sampleData,
      {}
    )
  }
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data