Query to blocks

Things I have tried

query block

What I’m trying to do

Could you help me understand the best way to do the following: I want to see blocks from different notes aggregated on specific pages.

Example:

I have [project1], [project2] and [meeting1], [meeting2] notes.

So in these meetings, I have some notes about both projects like this:

[meeting1]

  • Note text1… [project1] #idea

  • Note text2… [project1] [project2] #focus

[meeting2]

  • Note text3… [project2] #idea

  • Note text4… [project1] #focus

so for projects notes, I want to see info from meeting notes aggregated like this:

[project1]

Ideas

  • Note text1…## Focus

  • Note text2…* Note text4…

[project2]

Ideas* Note text3… ## Focus* Note text2…

One solution would be embed query, but it not very customizable.

Am I right that dataview plugin will not help me here since it doesn’t work with blocks?

I’m being told that “a dataview query can show text under a specific header.”, but I’m not sure how to do that.

Am I’m missing something?

If you use bullet point lists as a way to write your specific notes related to projects, then you can use dataview to querying them. An example:

1. meetings notes

meeting1


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquet eu nibh sed pharetra.

- Note text1… [[project1]] #idea
- Note text2… [[project1]] [[project2]] #focus

Praesent sit amet magna vel lacus condimentum finibus id ac quam.

meeting2

Cras eu eros posuere, molestie lacus at, laoreet purus.

- Note text3… [[project2]] #idea
- Note text4… [[project1]] #focus

Phasellus sodales ex turpis, et vehicula mauris euismod at. Duis pulvinar dictum commodo.

2. projects notes

project1 or project2 or …

## Ideas

(table)
```dataview
TABLE WITHOUT ID regexreplace(Lists.text, "\[.*$", " ") AS Notes, file.link AS meeting
FROM "your-folder-path"
WHERE file.lists
FLATTEN file.lists AS Lists
WHERE contains(Lists.outlinks, this.file.link)
WHERE contains(Lists.tags, "#idea")
```

(list)
```dataview
LIST WITHOUT ID regexreplace(Lists.text, "\[.*$", " ")
FROM "your-folder-path"
WHERE file.lists
FLATTEN file.lists AS Lists
WHERE contains(Lists.outlinks, this.file.link)
WHERE contains(Lists.tags, "idea")
```

---

## Focus

(table)
```dataview
TABLE WITHOUT ID regexreplace(Lists.text, "\[.*$", " ") AS Notes, file.link AS meeting
FROM "your-folder-path"
WHERE file.lists
FLATTEN file.lists AS Lists
WHERE contains(Lists.outlinks, this.file.link)
WHERE contains(Lists.tags, "#focus")
```

(list)
```dataview
LIST WITHOUT ID regexreplace(Lists.text, "\[.*$", " ")
FROM "your-folder-path"
WHERE file.lists
FLATTEN file.lists AS Lists
WHERE contains(Lists.outlinks, this.file.link)
WHERE contains(Lists.tags, "#focus")
```

notes:

  • to hide the links and the tags in the note text output I used a basic regex expression (I don’t know regex to do a more complex/flexible expression)… but that only works if you follow the order “text” + “links” + “tags”, because it hides everything after the first “[” in the raw text.
3 Likes

Thank you so much for the detailed answer.

I will use your script with lists, it’s a good option

You’re using the query to pick out the bulleted item, but the link is to the file. Is it possible to get the link to the particular block of the bullet point?

Given a lengthy note, you would otherwise need to search for the specific item again.

Regards,
Even Holen

We have, as metadata, the line where the bulleted item is placed. But I don’t know any way to work with that value to add it to the link. Nonetheless, it’s possible to target via link the header/section under which the item is placed.

Perhaps, we can give embed query a 2nd chance, :smiley:

For the Porject 1 note:

with the help of Obsidian Query Control plugin, the result looks like:

3 Likes

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