Get list items by tag, plus all descendents #2648
Unanswered
nikclayton
asked this question in
Q&A
Replies: 0 comments
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 is a bit related to https://github.com//discussions/1329 and https://github.com//discussions/1018 I think, but just different enough that it merits its own discussion]
In my daily journal (one file per day) I have a list of items. The first item in the list is tagged and contains some text, the remaining items are children (or grandchildren). For example:
Over in my folder for "Project One" I want to have a "Project One Journal" file that includes the relevant items from the the daily journal, by date. I..e., suppose the above example is in a file called "2026-01-03" I want the query output to be:
Where the "2026-01-03" is a link to the journal file.
This feels like something that should "just work" (or possibly I'm using Obsidian wrong, and I should structure my data slightly differently to make this easier).
Here's what I tried that doesn't work, and why (assume all of these are in fenced blocks tagged
dataview):Option 1
Query:
Output:
Wrong because: It's missing the first item, and the grandchild.
Option 2
Query:
Output:
Wrong because: (a) that's not a typo, there are two bullet points on the third line, (b) it's missing the grandchild.
Works
Inspired by the discussion in https://forum.obsidian.md/t/displaying-all-item-information-file-lists-text-including-multiple-children/78654/6 I adapted the code there slightly.
In a
dataviewjscode block put:This adds a new
listWithChildrenfunction so I can call this from multiple places in my vault.To use it I write (
dataviewblock):and that gives the expected output.
Beta Was this translation helpful? Give feedback.
All reactions