Support for null query
ErnieBernie10 opened this issue · 6 comments
I want to use a filter that would generate a query like: $filter=Name eq null
but this is not currently possible. Passing null to the eq
function is not possible and passing null as a string puts it between quotes like 'null'
Is there any way around this and if not can this feature be added?
Let me check about this
Hello @ErnieBernie10
Sorry for the late reply, I've released a new version 2.13.0
to support create filter with null
const filter = OData.newFilter().field("Name").eq(null)
if you can not upgrade the version of @odata/client
, you can easily create a param with free text
const param = OData.newParam().filter("Name eq null")
Thanks
I actually updated the package and there's still no support for null
When looking at the code in the repo I also see the type of the eq param does not accept null. Not sure if I'm just missing something or what.
Hello @ErnieBernie10,
Could you provide more information about your project, with some code snippet or error statck?
Here are the unit tests about eq null
, you can ref these
light-odata/tests/filter.spec.ts
Lines 17 to 20 in 3822266
light-odata/tests/read.spec.ts
Lines 84 to 92 in 3822266
Thanks :)
I'm talking about the parameter type definition of eq
here:
Lines 127 to 130 in 3822266
It does not accept null. Perhaps it would work when using plain js but the typescript compiler complains
Hi @ErnieBernie10 ,
I guess you are using strictNullChecks
in your ts config, you can simplely disable it in compileOptions
, or, try the new version 2.14.0
, I've added the null
to the method declaration.
Thanks, have a nice day :)