How can I provide a default value if a field is ONLY null? #2380
Unanswered
bitwizeshift
asked this question in
Q&A
Replies: 1 comment
-
|
Bit late, but for those looking for an answer you can do: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This seems like a basic question, but I can't seem to find a working solution. A search through the existing Q&A didn't yield the same question, so please excuse me if it's been asked before.
I have a document that looks like:
I want to select the
.some-node.enabledand, if it's not specified (i.e.null) it will default totrue.The problem is that the expression
.some-node.enabled // trueyieldstrue100% of the time because, for some reason,//coalesces tofalseornullto the second value. What I'm wanting is something that does true coalescing of onlynullvalues.Some sources are suggesting instead using an
ifstatement, but any time I attempt something like:It fails with an error like:
I'm sure I'm overlooking something simple; this must be supported, right?
Beta Was this translation helpful? Give feedback.
All reactions