Simply, I want to display the entire “item”/ piece of data, including children.
So for the majority of my notes, like meeting minutes, I use a lot of indented bullets, but these are all separate “items” and I cant display everything unless I have item.children, item.children.children and so on.
This is probably a very easy fix, I’m just missing something.
- [meeting:: update] || [disseminate:: team] || [date:: 2024-03-15]
- line 1 - blah blah blah
- line 1.1 - blah blah blah
- line 1.1.1 - blah blah blah
- line 1.2 - blah blah blah
- line 2 - whine whine whine
- line 2.1 - whine whine whine
- line 2.2 - blah whine blah
```dataview
table item.text
WHERE disseminate
FLATTEN file.lists as item
FLATTEN regexreplace(item.text, "\[[^\]]+::[^\]]+\](?:\s*\|\|\s*)?", "") as text
WHERE item.disseminate
WHERE contains(item.disseminate, "team")
WHERE file.cday >= ( date("2024-03-15") - dur(7days))
SORT file.cday
```
Besides having a disclaimer (or possible 2… ) the post below showcases on approach to extending the dataview query language with a function to show the text of all the item.children, which most likely could be adapted to your use case.
And yes, the case displayed there does work in current versions of Obsidian and Dataview.
Haha, that’s a lot of worrying forewarning! But despite the “risky” implementation, it doesn’t quite work for my application.
Inputs
- [example:: hello]
- there was this
- then this
- then that
- what what
- generic text
```dataviewjs
const dvF = dv.evaluationContext.functions
// Create a new DQL function
dvF.listChildren = (ctx, children, offset = "" ) => {
let result = ""
for (const child of children) {
result += offset + "- " +
(child.task ? `[${ child.status ?? " "}] ` : "" ) +
child.text + "\n"
if (child.children.length)
result += dvF.listChildren(ctx, child.children, offset + " ")
}
return result
}
```
```dataview
LIST WITHOUT ID item.text + "\n" + listChildren(item.children)
WHERE file.lists AND example
LIMIT 5
FLATTEN file.lists as item
WHERE !item.parent
```
Remember that you need to single out just the list item you want, so try the following:
```dataview
LIST WITHOUT ID item.text + "\n" + listChildren(item.children)
WHERE file.lists AND example
LIMIT 5
FLATTEN file.lists as item
WHERE !item.parent` AND item.example
```
Here is a slightly modified version, not the addition of the if (offset == "") result += ... section at the top, and a change of name to listWithChildren:
```dataviewjs
const dvF = dv.evaluationContext.functions
// Create a new DQL function
dvF.listWithChildren = (ctx, item, offset = "" ) => {
let result = ""
if (offset == "")
result += item.text + "\n"
for (const child of item.children) {
result += offset + "- " +
(child.task ? `[${ child.status ?? " "}] ` : "" ) +
child.text + "\n"
if (child.children.length)
result += dvF.listChildren(ctx, child.children, offset + " ")
}
return result
}
```
And now the query looks like:
```dataview
LIST WITHOUT ID listWithChildren(item)
WHERE file.lists AND example
LIMIT 5
FLATTEN file.lists as item
WHERE !item.parent AND item.example
```