I create a “project” page that is linked to a series of “other” pages by listing them in the tags:: property of the “project” page. I tag some blocks on those “other” pages with #Issue.
I would like a query that lives on the “project” page that returns all the blocks tagged with #Issue that live on the pages listed in the tags: property of the tags:: “project” page. I can write a query that explicitly lists the pages from the tags:: property, but there must be a way to dynamically include that tags:: list?
I didn’t explain myself clearly. In my description the page I referred to as “project” is the current page on which the query will be stored. It could have any name.
Its properties would look like:
etype:: Project
estatus:: Active
tags:: Page1, Page2,
I’m looking for any blocks on Page1 and Page2 etc. that contain #Issue
My template for pages of type Project will contain the query
To me both queries return the same results. I would suggest that you create a new graph with minimal simple blocks and pages, and start building the query one step at a time, ensuring that each step returns the expected results, until you reach the step that this breaks. For example, the following query should return the tags:
I simplified everything and it works for me too. I simplified my description too much. The pages are actually in a namespace hierarchy. And that is the problem.
So:
ProjectPage/Page1
ProjectPage/Page2
with the query on ProjectPage. Its properties:
etype:: Project
estatus:: Active
tags:: ProjectPage/Page1, ProjectPage/Page2, …
I changed my (working) simplified setup to put Page1 in a namespace and then only Page2 worked. Is there a solution? Your attention is much appreciated!!!
What do you mean? Do you set journal names as values in property tags:: ? Please keep providing examples for us to reproduce and facilitate the communication.
Sorry for the vagueness. Can the query be enhanced to also find blocks on Journal pages with the #Issue tag for the pages in the tags:: list on the query-page ?
So, a block on a journal page could look like:
#ProjectPage/Page1
This a description of a #Issue
or
This is an #Issue for #ProjectPage/Page1
I had thought the journal pages would automatically be in scope but I guess this combination has to be found solely at the block level?
Advanced queries are on purpose the opposite of automatic, so as they can be precisely tailored. Therefore, should explicitly add a separate case, replacing [?b :block/page ?p] with:
I see that if I put both the page and the Issue tag in the same block then it works. When I notetake I’ll indent all the notes for project as blocks under a line with the projects page as a tag or as a link.
This works using the simple query with the page links [[Site0/Page1]], [[Site0/Page2]] explicitly defined. Is getting that list of page links in from the tags:: just not possible? While it works for me, perhaps I’m not structuring the notes the way logseq is designed for.