I am creating a query entity rule where I need to compare one of my ri value whi

I am creating a query entity rule where I need to compare one of my ri value which is date type with the DB column which is datetime type. I am getting error, Cannot apply operator [EQUALS] to field [UpdatedDateTime] when comparing to value [TypedValue[it=7,v=2016-06-17]].

How to achieve this?

OriginalPostID-219192

OriginalPostID-219192

  Discussion posts and replies are publicly visible

Parents
  • I might be wrong, but afaik, I don't think that simply making use of todatetime() or cast() as suggested above will help you here because I can clearly see that you need to filter the data based on the date whereas the data consists of timestamps and these may not match against the filter value because I guess usage of conversion functions on a date will evaluate to the latest time based on the logged in user.

    There could be two solutions here as per my knowledge:

    1. Add one more column in your view which gets the date part from the existing timestamp column and use this to filter the data.
    2. Build a datetime range query filter on the corresponding timestamp column, for instance, you may do as follows and use the same as filter in the queryEntity(). This way you can get all the records associated with a particular date without much bothering about their timestamps.

    a!queryFilter(
    field: "myTimeStampColumn",
    operator: "between",
    value: {datetime(year(ri!date),month(ri!date),day(ri!date),0,0,0),datetime(year(ri!date),month(ri!date),day(ri!date),23,59,59)}
    )
Reply
  • I might be wrong, but afaik, I don't think that simply making use of todatetime() or cast() as suggested above will help you here because I can clearly see that you need to filter the data based on the date whereas the data consists of timestamps and these may not match against the filter value because I guess usage of conversion functions on a date will evaluate to the latest time based on the logged in user.

    There could be two solutions here as per my knowledge:

    1. Add one more column in your view which gets the date part from the existing timestamp column and use this to filter the data.
    2. Build a datetime range query filter on the corresponding timestamp column, for instance, you may do as follows and use the same as filter in the queryEntity(). This way you can get all the records associated with a particular date without much bothering about their timestamps.

    a!queryFilter(
    field: "myTimeStampColumn",
    operator: "between",
    value: {datetime(year(ri!date),month(ri!date),day(ri!date),0,0,0),datetime(year(ri!date),month(ri!date),day(ri!date),23,59,59)}
    )
Children
No Data