This is awesome! I really like how you can dive deep into it
I see blacksmithgu has just added more support weeks:
Perhaps you can use this to reduce some of the noise in how the dates are rendered on the right side there.
This is awesome! I really like how you can dive deep into it
I see blacksmithgu has just added more support weeks:
Perhaps you can use this to reduce some of the noise in how the dates are rendered on the right side there.
Good point! Iāll need to check those out. Lots of new goodies this week
Iām not sure if this way always possible, or just recently added, but you can create indented lists when a noteās field is an array.
For example, show a list
of all literature notes, with a sublist of authors from each:
list authors from #LitNote
This feature seems to have alot of potential, but I donāt think the example in the docs works as at 2021-03-24. The following is what I found to work.
You can add strings and fields to the result of a list
query.
For example, in each university assignment, I have the type
of assignment, as well as a field intensity
with a green, yellow, or red square indicating how much effort will be required of me:
---
intensity:
type: āEssayā
---
Then, using +
as a concatenation operator, you can write a string containing field values:
list "This much work " + intensity + " required for the " + type
from #Assignment
You can now also very easily create a list of backlinks:
list from [[note]] // List all notes which link to [[note]]
Or an index of all links leaving a note:
list from outgoing([[note]]) // List all notes that [[note]] links to
Coupled with the Templater plugin, you can create a template to quickly insert into any note:
# Backlinks
```dataview
list from [[{{tp_title}}]]
```
# Index
```dataview
list from outgoing([[{{tp_title}}]])
```
This might be very basic, but can I have the results published transcluded? So instead of the list produced being [[File_name]] it would be ![[File_name]].?
Not currently, no. If this isnāt already a feature request, I think itās a great idea to post!
Iāve been looking all over for how to query around nested tags.
For instance, I may have a bunch of notes to aggregate Standard Work for my teams, but those will have nested tags. For a MOC page, I may want to create a list of all the Standard Work pages I have in my vault, inclusive of all of the nested tags. A way I would think I could write that is:
list from #standard-work/**
But I canāt find an ergonomic way of writing a query like this which doesnāt require me to where-clause against every known case of nested tag which is more static than Iād like. (I donāt want to update this page every time I add a new nested tag).
Any thoughts in the community?
Just to clarify, your questions says āI may want to create a list of all the Standard Work pages I have in my vault, inclusive of all of the nested tagsā. So you want to list every page tagged with #standard-work
and also every page tagged with #standard-work/something/maybeMore
?
This snippet should do that:
list from #standard-work
Dataview already matches nested tags, so that list from #Tag
should match #Tag
as well as #Tag/sub
This ability to add the Backlinks and Index is awesome! Thanks.
Has anybody tried the GROUP BY
? I tried that but didnāt get the expected result.
For example, say I have some notes with the tags #Note/Author, #Note/Principle, #Note/Conceptā¦how can I group all the results with tag #Note according to their subtags?
Could anyone help?
I actually hadnāt figured it out myself, but your question made me give it a go. I think Iāve got itā¦
So, Iām gonna use an example:
In each of my assignments, I have a field (intensity
) with a red, yellow, or green square telling me how much work will be required.
So, if I want to group all of my assignments by their intensity, I do the following.
First, gather all the assignments:
FROM #Assignments
Then, group by intensity
:
GROUP BY intensity
rows
ObjectNow, here is the part that confused meā¦ by grouping them, youāve now got a new object created by the grouping. This is a nested list of all the assignments grouped by intensity. So something like:
[
[A1, A2, A6], // Green
[A3, A4], // Yellow
[A5, A7] // Red
]
The way you access this new list is with the rows
object.
So if I want the file name of every note in the array, I call rows.file.name
.
If I want the dueDate
of each note in the array, I call rows.dueDate
.
In this example, I call the title
property (rows.title
).
Now, you sorta have to change the ordering around, but it should still make sense.
TABLE intensity, rows.title
FROM #Assignment
GROUP BY intensity
Which gives me this, as desired:
So for your example, you want to group files by subtag. Can you try this and let me know what you get? I think the output will be a little messy, because it repeats alot of the tags, but it should still group them as you want.
TABLE rows.file.name, rows.file.tags
FROM #Note
GROUP BY file.tags
Also, it will only consider two notes to be in the same group if they have exactly the same tags. So even if two notes have #Note/Author
, if the one has a tag that the other doesnāt, I donāt think theyāll be grouped together.
wow @SkepticMystic Thank you so much for your elaborate and earnest answer! It does help a lot!
It is the rows Object that confused me too, and youāve made it so clear. I tried replacing the rows.file.name with rows.file.link under your instruction, and now it works quite perfectly.
Just to let you know you helped me solve the long time problem.Thanks so much again!
Is there a way to show the number of result rows ?
Iām really glad to hear it helped!
Thank you for getting me to finally figure out how group by
works
I tried a hacky method which didnāt seem to work.
I thought to use length()
or sum()
, but each of these only works as a test in a where
block; it doesnāt give a returnable value.
I think this would be really useful though. Check if itās an existing feature request and give it an upvote, otherwise make a new post for it
For now, you could totally pair dataview with the Obsidian Query Language plugin (OQL).
After your dataview table/list, put an OQL codeblock underneath it to show the {count}
of the same query.
Thanks a lot for your help.
I also tried to play with Group By
and āsumā and ālengthā functions but like you said, it doesnāt seems to work in this context.
I thought that OQLās queries only rely on foldersā¦ I will check the doc again to see if it works also with yaml frontmatter metadata.
I havenāt used OQL very much, so its definitely possible that it doesnāt allow querying on the same objects as dataview.
But I think this would be a useful feature to request in a future update
So your post got me thinking alot, and I think Iāve figured out a workaround for seeing how many results get returned!
This CSS snippet will number the rows of a dataview table:
.table-view-table {
counter-reset: section;
}
.table-view-table > tbody > tr > td:first-child::before {
counter-increment: section;
content: counter(section) ". ";
}
Resulting in something like this when you make a table: