obsidian-dataview
obsidian-dataview copied to clipboard
Support for alternate checkbox tasks
I've been using alternate checkboxes to track different task states, inspired by SlRvb's implementation in their ITS theme, and I've discovered that Dataview only recognizes checkboxes that have ' ', 'x', or 'X' in the box. Dataview ignores top-level checklist items that have any other character in the box, and nested alternate checklist items include "[char
] " in their text
.
Ideally, Dataview could recognize any bulleted item with any single character in the box at the front as a task. It would also be helpful to include that character as the task's state
, status
, type
, or something along those lines.
Possible extensions:
- Numerical tasks like
- [2/10] Do this thing 10 times
- Unicode glyphs (e.g. emoji)
cc @eleanorkonik
I would love to retire this dataviewjs for what it's worth. https://gist.github.com/eleanorkonik/c650c193751436463f427690f680546e
Will be available as task.status
in the next major update.
When is the next major update planned?
@stoweboyd, it's in beta already! Go test it out!
It's currently available in beta (0.5.0) - you can use the Obsidian BRAT plugin to pick up beta releases.
I tried it, and a bunch of my Taskidian queries broke. I'll wait until there is a detailed write-up.
And I tried task.status and that didn't work either. Maybe I am not configuring options correctly.
In task queries it is just available as status
(WHERE status = '<'
for example).
Please share any broken task queries you have - the beta release is predominantly for me to catch breaking changes like queries not working.
this query no longer works:
due today
TASK
WHERE !completed
WHERE (due = date(2022-03-26))
GROUP BY ø
Note: 'ø' is an attribute on in my task system, '- [ ] [ø:: !]' is an urgent task, for example. This will be replaced by '- [!]' when this evolution of dataview settles down.
All my other 'due this week' type queries break in the same way
I tried this query:
TASK FROM "00 workings"
WHERE !completed
WHERE status = '!'
And got an error:
so the "status = '!'" doesn't seem to work. Likewise when trying as a string "!".
The checkbox character doesn't look like it's being picked up ATM.
Use double quotes and not single quotes for strings - WHERE status = "!"
.
I tried with double quotes (again). No worko.
And still getting the 'maximum call stack size exceeded', too.
@stoweboyd The reason your query is not working is because you are filtering on completed
- completed
is true as long as the status is not empty, to mimic Obsidian default rendering behavior, so a task marked '!' is considered completed. Just get rid of that check:
TASK FROM "00 workings"
WHERE status = "!"
I can consider changing the semantics of completed
while still in beta to only be true if the task status is 'x' or 'X'; I'm not sure if that would break any existing behavior. Possibly not.
Also, do you have some dummy example tasks that show the broken "stack call exceeded error"? I've fumbled with some basic GROUP BY task queries but been unable to break it.
Re: !completed -- I will give that a try. It means I have to restructure queries, if I only want to see uncompleted tasks though, like '(status = "!") OR (status = "?") OR (status = "=")' and so on, for all non-completed task statuses.
Re: stack call error -- could be related to the number of tasks in my vault, right?
Here's one:
TASK
FROM "2022 journal" OR "00 work futures" OR "2021 journal" OR "00 other
projects"
WHERE (øø = "work futures") AND !completed AND (ø != ":")
GROUP BY ø
A typical Taskidian task is formed like '- [ ] [øø:: !] [øø:: work futures] some text'
Stowe
On Sat, Apr 2, 2022 at 6:03 PM blacksmithgu @.***> wrote:
I can consider changing the semantics of completed while still in beta to only be true if the task status is 'x' or 'X'; I'm not sure if that would break any existing behavior. Possibly not.
Also, do you have some dummy example tasks that show the broken "stack call exceeded error"? I've fumbled with some basic GROUP BY task queries but been unable to break it.
— Reply to this email directly, view it on GitHub https://github.com/blacksmithgu/obsidian-dataview/issues/812#issuecomment-1086731799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFR3UPSVASKEYWBHIXSSTVDC7ZZANCNFSM5MZ3AIEA . You are receiving this because you were mentioned.Message ID: @.***>
I realized after thinking for a few minutes that '!completed' in your new approach should be equivalent to '(status != "x")'.
I reinstalled, and all my queries have the 'max call stack' error.
Here's one:
TASK
WHERE (status != "x")
WHERE (due = date(2022-04-07))
GROUP BY status
I get
Dataview: RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at ListItem$1.serialize (eval at
Take care.
| Stowe
On Wed, Apr 6, 2022 at 7:20 PM Stowe Boyd @.***> wrote:
Re: !completed -- I will give that a try. It means I have to restructure queries, if I only want to see uncompleted tasks though, like '(status = "!") OR (status = "?") OR (status = "=")' and so on, for all non-completed task statuses.
Re: stack call error -- could be related to the number of tasks in my vault, right?
Here's one:
TASK FROM "2022 journal" OR "00 work futures" OR "2021 journal" OR "00 other projects" WHERE (øø = "work futures") AND !completed AND (ø != ":") GROUP BY ø
A typical Taskidian task is formed like '- [ ] [øø:: !] [øø:: work futures] some text'
Stowe
On Sat, Apr 2, 2022 at 6:03 PM blacksmithgu @.***> wrote:
I can consider changing the semantics of completed while still in beta to only be true if the task status is 'x' or 'X'; I'm not sure if that would break any existing behavior. Possibly not.
Also, do you have some dummy example tasks that show the broken "stack call exceeded error"? I've fumbled with some basic GROUP BY task queries but been unable to break it.
— Reply to this email directly, view it on GitHub https://github.com/blacksmithgu/obsidian-dataview/issues/812#issuecomment-1086731799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFR3UPSVASKEYWBHIXSSTVDC7ZZANCNFSM5MZ3AIEA . You are receiving this because you were mentioned.Message ID: @.***>
This seems very odd and broken; the only way this call stack issue can happen is if the Obsidian metadata cache reports that a list element has a parent of itself or some other bad construction.
I've added an assertion to guard against this case, which may not fix the views but at least will give a more useful error. It's included in new release 0.5.8.
For reference/comparison/assurance:
- Task Collector doesn't fuss with default browser behavior of
checked
(has a value) - I do treat either
x
orX
as completed. You can opt-in to also treating-
as completed.- A recent ask was to suppress/remove
X
from this list, which I've done.
- A recent ask was to suppress/remove
- You can then specify values for "incomplete" items (as a simple string).
- If you removed
X
from the above list, it is eligible to be included here instead.
- If you removed
Snippetor looks for these settings to help people set up custom/styled snippets:
- https://github.com/ebullient/obsidian-snippetor/blob/b1346a636ada43bad5bc2098721aafcef33ce8a7/src/snippetor-Snippetor.ts#L29
- https://github.com/ebullient/obsidian-snippetor/blob/b1346a636ada43bad5bc2098721aafcef33ce8a7/src/%40types/index.d.ts#L116
So I would suggest that dataview keep the HTML semantics of checked
(has a non-empty value or not), and avoid crossing that with the meaning of "completed" (which we are all actively turning into something else). Specifically, this:
- https://github.com/blacksmithgu/obsidian-dataview/blob/cea1c2acfc8745c208227706bd67d3a109a2cca9/src/ui/views/task-view.tsx#L64
To get the Task Collector completion modal to work with dataview, I would need to override or augment what is happening here: https://github.com/blacksmithgu/obsidian-dataview/blob/cea1c2acfc8745c208227706bd67d3a109a2cca9/src/ui/views/task-view.tsx#L47
e.g. to allow dataview to open the task collector modal so someone could specify what value to mark the item with. Given this is a callback assigned directly on the item, I am a bit at a loss for how best to try to do anything else. I can intercept the click, but I don't then have the context to update the document with the character in a way that makes sense..
I'll need to add an API option for overriding the click handler - that way Dataview can provide the task metadata and source file.
that would be amazing!
This will help with themes/snippets applying properly. The currently generated tasks don't have the information where snippets/themes expect it: https://github.com/blacksmithgu/obsidian-dataview/pull/1047
This works (for using the task collector modal to get the status character): https://github.com/blacksmithgu/obsidian-dataview/pull/1048
I am not sure if I should put the issue I have here, please let me know. So now "status" becomes an implicit field for dataview, I seem to not be able to filter my page level "status" field at Where clause anymore. Will there be a solution for this, or do I have to change my "status" field for something else for sure? I have a project with status:: [[active]] for example. On this project page, I have several tasks under two sections. In another note, I used dataview task to list those tasks:
from "folder"
where contains(type, [[note]]) and contains(category,[[project]]) and contains(status, [[active]])
where contains(meta(section).subpath, "action items 1")
group by section
sort due asc
Good point, I think you'd have to change the status field. A simple search and replace should suffice.
It all works! Thanks for your efforts.
Take care.
| Stowe
On Fri, Apr 8, 2022 at 3:51 PM Stowe Boyd @.***> wrote:
I'll give it a try over the weekend.
On Fri, Apr 8, 2022 at 4:03 AM blacksmithgu @.***> wrote:
This seems very odd and broken; the only way this call stack issue can happen is if the Obsidian metadata cache reports that a list element has a parent of itself or some other bad construction.
I've added an assertion to guard against this case, which may not fix the views but at least will give a more useful error. It's included in new release 0.5.8.
— Reply to this email directly, view it on GitHub https://github.com/blacksmithgu/obsidian-dataview/issues/812#issuecomment-1092569372, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFR3WYVSEDYF75TWUJMPLVD7R63ANCNFSM5MZ3AIEA . You are receiving this because you were mentioned.Message ID: @.***>
I'll give it a try over the weekend.
On Fri, Apr 8, 2022 at 4:03 AM blacksmithgu @.***> wrote:
This seems very odd and broken; the only way this call stack issue can happen is if the Obsidian metadata cache reports that a list element has a parent of itself or some other bad construction.
I've added an assertion to guard against this case, which may not fix the views but at least will give a more useful error. It's included in new release 0.5.8.
— Reply to this email directly, view it on GitHub https://github.com/blacksmithgu/obsidian-dataview/issues/812#issuecomment-1092569372, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFR3WYVSEDYF75TWUJMPLVD7R63ANCNFSM5MZ3AIEA . You are receiving this because you were mentioned.Message ID: @.***>
Let us know so we can close the issue.
I use this code to list the top notes with unchecked tasks, but it counts alternate checkboxes as non-completed. How can I make it also count alternat checkboxes as completed?
TABLE length(filter(file.tasks, (t) => !t.completed)) AS "Uncompleted" WHERE file.tasks AND length(file.tasks) > 0 AND length(filter(file.tasks, (t) => !t.completed)) > 0 SORT length(filter(file.tasks, (t) => !t.completed)) DESC