blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.94k stars 411 forks source link

Create a LIST query similar to TASK #1202

Open ryadaj opened 2 years ago

ryadaj commented 2 years ago

Is your feature request related to a problem? Please describe. Obsidian provides a useful native search/query block tool, but it is cumbersome and looks cluttered when embedded in notes. Dataview offers a preferable formatting for search results and is more flexible.

However, it is difficult to show the text contained in a nested list, when this could be beneficial for understanding the context in which a result occurs.

Describe the solution you'd like It would be helpful if we could query lists in our vault and display not only the first level, but the sub-lists/dependent lists/child lists (not sure the correct term). For example, in the image below I would like to see the header and the content of the sub-list in the dataview query seen on the right in red.

Screen_Shot_2022-06-20_at_12 26 08

Describe alternatives you've considered Query blocks and clicking "show more context" are the simplest solution but that requires clicking and is visually not appealing.

@mnvwvnm provided this work-around:

TABLE WITHOUT ID L.text, L.children.text, L.children.children.text
FROM #prj/phd/dissertation/proposal AND #entmoot 
FLATTEN file.lists as L 
WHERE !L.status 
WHERE contains(L.tags, "#prj/phd/dissertation/proposal") 
WHERE contains(L.tags, "#entmoot")
Screen_Shot_2022-06-20_at_12 43 22

Additional context

blacksmithgu commented 2 years ago

I think there are two main points:

The TASK query could probably be renamed or aliased into something that supports both list items and tasks... maybe HEIRARCHICAL.

sudoexec commented 1 year ago

I also need this feature. Is there any plan on it?

xim commented 1 year ago

+1, I'd love to be able to show all lists correctly nested, regardless of whether or not they contain tasks, from a different note.

Current dataview query added to all my daily notes; Brings in all the lists I made in that note, typically things I want to carry over to the next day:

LIST file.lists.text
FROM "Daily"
WHERE file.name != this.file.name AND file.day < this.file.day
SORT file.day DESC
LIMIT 1

Only real problem is that it doesn't nest the output.

SpocWeb commented 11 months ago

+1 But if you have multiple Lists in the same Document, they should be grouped or groupable e.g. by the Heading they are under.

Eventually it would be nice, if you had capabilities like in YAML where you can not only write Lists but Dictionaries:

## ListA: - A1 - A2

## MappingB: - key1: value1 - key2: value2

Then you could choose whether to show the Data in the Document or hide it in the Frontmatter.