Query for blocks with tag in table view

Hello,

i try to list all blocks from a specific page with a specific tag.

Example Page:

  • Entry 1
    • tags:: #tag1
    • blabla
  • Entry 2
    • tags:: #tag1
    • blabla
  • Entry 3
    • tags:: #tag3

If tried this query:

#+BEGIN_QUERY
{
:title [:b "blocktags - select and exclude block level tags"]
:query [:find (pull ?block [*])
:where
[?block :block/content ?blockcontent]
[?block :block/page ?page]
[?page :block/name ?pagename]
( and
(page-ref ?block "tag1")
)

]
}
#+END_QUERY

This works in list view. But in table view i get

Instead tags:: #tag1 i would like to see Entry 1 for example. Is this possible?

I think what you want to do is bring your property to the block it is related to instead of having the property in it’s own separate block. (using shift+enter to create a new line instead of a new block)

So:

  • Entry 1
    tags:: #tag1
    • blabla
  • Entry 2
    tags:: #tag1
    • blabla
  • Entry 3
    tags:: #tag3

Hey, thank your for the answer.
This Solution works but will break my notes visually.

I ended by making pages instead of blocks.

Thx anyway, i learned a lot from your posts.

1 Like