Dataview - Group Inline Fields by Headers

When extracting notes from a paper or other source I often use inline fields like “Conclusion:: …” to later be able to source certain parts via Dataview.

Is it possible to create a dataview query that Groups (and sorts) inline fields by the header in which they appear under?

For example, how would I be able to utilize dataview to group/sort the following inline fields in the following note:
"

Header 1

Sub-header 1

Conclusion:: some text -1

Sub-header 2

Conclusion:: some text-2
"

This is what I have so far…

Table rows.Conclusion as ""
WHERE file.name = this.file.name
GROUP BY tag

Any help is greatly appreciated!

Seems to be possible if the Conclusions are tasks.

Someone else will probably have a better solution, but the text and query below work in local tests (use ‘paste and match style’ to preserve the layout).

# 1 heading
## 2 heading
- [ ] Conclusion:: some text-1
### 3 heading
- [ ] Conclusion:: some text-2
### 4 heading
- [ ] Conclusion: some text-three
#### ==Dataview query==
```dataview
TASK 
WHERE 
	file.name = this.file.name
GROUP BY 
	header
```

A similar approach can be done using lists, but involves a little more mangling of data, as you need to grab a hold of the section link and manipulate that into using the section part.

Regarding the task option though, I’m using a similar technique in combination with task decorations, or special markup of the task to indicate that it’s not a task but rather something informational. (For some examples, see Checklists - Minimal Documentation . New icons can rather easily be added to this list)

Using that style of markup, you could use an icon for all “conclusion” tasks, and write it like:

- [C] Some text-1

And then use queries like:

```dataview
TASK
WHERE status = "C"
```

This would then also allow direct links straight into the line of the task, and it doesn’t “clutter” the conclusion as much as using [conclusion:: ...] does (before you potentially style it out of existence).

3 Likes

That really adds a layer of elegance. Thanks for sharing. Hope the OP can get some use out of these ideas.

:partying_face::+1::dancer:

Yeah I’ve decided to switch to using tasks as opposed in inline fields! I couldn’t find any other way around it.

Thanks for the recommendations! @holroy - It really helped target my search.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.