Unable to retrieve data from queryEntity for a date range

Unable to retrieve data from queryEntity for a date range. The below code is not working and instead throwing an error that "between" operator cannot be used. Please advise how to fix it.

local!chartDatasubset: a!queryEntity(
entity: cons!NSARequest_Entity_Cons,
query: a!query(
aggregation: a!queryAggregation(
aggregationColumns: {
a!queryAggregationColumn(field: "Status", alias: "Status", isGrouping: true),
a!queryAggregationColumn(field: "SubmittedDate", alias: "SubmittedDate", isGrouping: true),
a!queryAggregationColumn(field: "Id", aggregationFunction: "COUNT")
}
),
filter: a!queryFilter(
field: "SubmittedDate",
operator: "between",
value: { if(isnull(ri!StartDate), today(), ri!StartDate), if(isnull(ri!EndDate), today(), ri!EndDate) }
),
pagingInfo: local!chartPagingInfo
)
),

 

 

Initially had an expression rule below which used to be working in 18.3 version. Not sure if in new 18.4 version it isn't. Please advise.

 

with(
local!chartPagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: -1,
sort: a!sortInfo(
field: "SubmittedDate",
ascending: true
)
),
a!queryEntity_18r3(
entity: cons!NSARequest_Entity_Cons,
query: a!query(
filter: {
a!queryFilter(
selection: "",
field: "SubmittedDate",
operator: "between",
value: { ri!StartDate, ri!EndDate }
)
},
pagingInfo: local!chartPagingInfo
)
)
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    I believe the if() statements you're using in the filter are causing the issue. The type (107) that it's complaining about is "list of date", so i suspect your from: and to: dates are resolving as an array of 1 date each (as opposed to each one being a single element like it's expecting). I can't verify this, but I suspect your if() statements might be returning an array/list and this might be causing the issue.

    To quickly check this, please replace that line of code with this and try again:
    value: { if(isnull(ri!StartDate), today(), ri!StartDate)[1], if(isnull(ri!EndDate), today(), ri!EndDate)[1] }
Reply
  • 0
    Certified Lead Developer
    I believe the if() statements you're using in the filter are causing the issue. The type (107) that it's complaining about is "list of date", so i suspect your from: and to: dates are resolving as an array of 1 date each (as opposed to each one being a single element like it's expecting). I can't verify this, but I suspect your if() statements might be returning an array/list and this might be causing the issue.

    To quickly check this, please replace that line of code with this and try again:
    value: { if(isnull(ri!StartDate), today(), ri!StartDate)[1], if(isnull(ri!EndDate), today(), ri!EndDate)[1] }
Children
No Data