There is an example vault having loads of various queries, but in general I’m self-thaught related to Dataview. Although my background is a computer science profession, so I do know programming beforehand.
My best tip, though, is to try to get your task done by yourself as much as you can, and plunder away to get as close as you’re able to. And then ask questions.
And one way to get started is to approach any task from a general query version, and then keep narrowing it down until you’ve got what you really wanted. Related to this query in particular, tasks are kind of hard to get extra information out of, but there is a trick related using FLATTEN
where one can play around a lot more.
In fact, on the way testing my latest version, I had an intermediate version like the following:
```dataview
TABLE WITHOUT ID visual, T.text, T.tags, length(T.tags)
FLATTEN file.tasks as T
FLATTEN file.link + " " + T.text as visual
WHERE contains(list(" "), T.status) AND T.tags
WHERE file.folder = this.file.folder
SORT T.tag desc, T.file.name DESC
GROUP BY T.tag
```
Here I experimented with using length(T.tags)
to see if there was an issue with multiple tags when sorting, and I also ended up grouping on the tags, so if that was the case of the anomaly with the #Maybe tag.
The key point, just now, however is that instead of using a TASK
query, I do a TABLE WITHOUT ID
in combination with FLATTEN file.tasks as T
. Now I can access all the task related information through T.*
, and I can show multiple columns. This trick has proven useful when developing/refining many a (task) query.
When you’re ready to do the actual task query, you just need to remove the T.
part, and look over the other bits, to ensure it actually works as a TASK
query. You’ll get the hang of that part, rather quickly, hopefully.
But using TABLE
queries for debugging is really helpful, as you can then output whatever you intend to use in WHERE
, GROUP BY
, SORT
, … clauses, and see what value the query actually produces, and that your logic and variable handling is to the point and doing what you expect it to.