Block with tag in specific cousin block

Hello everybody,

I have a specific question regarding queries.

I have a template for my meetingnotes that i use every day in my journal.
This template looks like this

- ## Meeting <% today %> <% time %>
  template:: Meetingminutes
  template-including-parent:: true
  category:: meetingnotes
	- ## Project/Topic
	- ## Attendees
	- ## Discussion
	- ## Todos

I write a tag for every project in the project session, to link the meeting notes to the specific project.

My question would be, how has the query to be made if I want to query all TODOs inside those meetingnotes with the specific tag for a project?

Thanks in advance

Welcome. Could you provide one or more examples of meeting notes (i.e. a template filled with tags and TODOs)?

For sure

- ## Meeting 2024-06-20 10:00
  category:: meetingnotes
	- ## Project/Topic
		- #ProjectA
	- ## Attendees
		- John Doe
                - Dasseh Tugaax
	- ## Discussion
		- something we discussed
	- ## Todos
		- TODO Create a pitchdeck
                - TODO Do research about XYZ for preparation
                - TODO schedule a meeting with Jane Smith

Hope this helps

Can the Project/Topic section contain more than one tags?

  • If yes, wouldn’t that mix the tasks from different projects?
  • If no, have you considered moving the project tag to either:
    • a property, i.e. under category:: meetingnotes to put project:: #ProjectA
    • the Todos section, i.e. ## Todos for #ProjectA

No, I have only one tag per project.

I considered those things, but as I have a mix between internal meetings with no project and project specific notes I wanted to have the template as general as possible. This is the reason why the heading is labeled Project/Topic. When I have an internal meeting/discussion about a topic with no connection to a project I generally write the topic of the meeting.

Here is one way:

{:query [:find (pull ?todos [*])
 :in $ ?current-name
   [?current :block/name ?current-name]
   [?project :block/refs ?current]
   [?project :block/parent ?topic]
   [?topic :block/parent ?minutes]
   [?minutes :block/properties ?props]
   [(get ?props :category) ?category]
   [(= ?category "meetingnotes")]
   [?topic :block/content ?topic-content]
   [(= ?topic-content "## Project/Topic")]
   [?todos :block/parent ?minutes]
   [?todos :block/content ?todos-content]
   [(= ?todos-content "## Todos")]
 :inputs [:current-page]

Hi there.

Unfortunately this does not give me any result.
Just to make it a bit clearer.

I want this query to be executed on the page for the project, but it should query all the meetingnote blocks in my journal.

I tested it on the example that you provided above, which I pasted in a journal page, and it returns the todos normally. The query itself should be inside page ProjectA . Try doing the same, or provide more examples.

okay. My mistake.

I changed Project/Topic to Project/ProjectA, because I have also i hirarchy structure of my projects. Works well now thanks so much