Filter for empty field/date

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [x] Documentation issue or request

Current behavior

Not sure if I’m posting this in the right forum, but I’m looking for a way to filter through elements with an optional EndDate field. I need elements that either have that value empty or greater than current date. The latter I’ve managed but I can’t seem to take empty records into account. Here’s the OData query I’m using:

data/EndDate/iv eq null or data/EndDate/iv ge {currentUtcDate}

I’ve tried putting all 0’s instead of null, empty string etc. But I’m not getting the desired result. Couldn’t find the proper way to do this with OData either. The JSON I’m receiving when not filtering for EndDate doesn’t even have EndDate field on the data property that I could check the value of.

I’m thinking of putting a default value of 31/12/2099 in there so that it is not optional but there has to be a better way.

Expected behavior

Minimal reproduction of the problem

Add empty date field to your content, try to query for elements with said field empty.

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [x] Cloud version

Hi,

there is a special empty operator

empty(data/EndData/iv)

I’m getting the following error when using it:
“OData $filter clause not valid: No function signature for the function with name ‘empty’ matches the specified arguments. The function signatures considered are: empty(Edm.String Nullable=true)”