Currently, when a checkbox field is created, the value is blank. This does not register in Dataview queries. Instead, you have to click the box twice so that it cycles: true > false. It would be easier if the value was false when the checkbox is created.
Use case or problem
It’s possible to use the checkbox field as a way of identifying three statuses, such as not to be invited, to be invited and invited. That would be: absence of checkbox, checkbox = false and checkbox = true. But just creating the checkbox doesn’t register as false. You have to click it twice.
False is the default value for a checkbox.
Current workaround (optional)
I second this!
This is especially leading to problems when you for some reason edit your note in a way that you uncheck the previous checked checkboxes. Then you have some checkboxes that are
false and some that are
blank and everything is confusing.
Or another workaround: Don’t test for “false”. Test for “not true”. Then it will capture both states.
Thank you. What is the query?
where field = not true doesn’t work.
You’d have to check the plugin’s documentation. I said that as a concept, not syntax.
In the context of tasks, I believe the syntax is like this:
Wouldn’t that just give you all the notes without the “completed” field? The challenge is to find a query that will select for:
!= true (“not true”) kind of means something like “everything but
So, everything that’s explicitly
true should be discarded whereas any other values,
"" (blank) or
false, should be kept by the filter.
That’s for the principle .
On the other hand, still as a concept, one can also explicitly filter by
"" (blank), which should return the same result as
That’s very true! Good point.
dataviewjs query would be:
dv.list(dv.pages().where(page => page.field === null || page.field === false))
Someone can chime in with the
But I agree with your original request that
false should be the default.
This gives all results for me, eg values where field ===
undefined === most pages.
I’ll admit I didn’t test dataview queries , I was speaking more generally… and I always forget about
On the other hand, while writing this, I’ve tested this query :
WHERE contains(file.frontmatter, "check") AND check != true
check being a checkbox in
Properties which seems to return the appropriate notes when
false (but finds nothing if
Don’t get me wrong though, I have nothing against having
false as a default value for checkboxes .
That’s true (no pun intended). I hadn’t considered alternative checkbox values. I was mainly providing the
!completed syntax as it seems to be what is used as opposed to true and false according to the Dataview documentation. So I guess it would only work for people who only have the box checked, unchecked, or undefined.