Hello! I’m struggling to figure out how to write a query to get all the todos on a particular page. I thought there might be a generic way to do this for any page, but I’m even struggling to get it to work for a specific page using the page’s name. I think part of it is that I’m just learning the query syntax. Here’s what I’ve tried and learned:
{{query todo}} gives all the todos in my entire database
Then I tried to use a filter by page: {{query todo [[the book]] }} (“the book” is an alias to the page I’m trying to collect todos from). This is giving the same results as #1, which surprised me.
I thought, maybe I need to explicitly use logical expressions to tie the parts of the query together. So I tried {{query (and todo [[the book]]) }}, which was empty.
I’d appreciate any help filling the gaps in my knowledge and creating a query that collects todos on a given page.
Thank you @c6p, that worked! Now, any ideas on making this a more general query that will work on any page? I see that for templates there is a “current page” variable, but that doesn’t seem to apply to queries. I’ve also noticed some references to current page in the advanced query syntax, so maybe that’s where I need to be looking…
Thanks! This works fine on my page (and is another game changer vs. Roam, where I just come from). However, when opening the same page in the sidebar the query gives me the TODOs from the page opened in my main view. Is this intended behavior or a bug?
so in the current page that goes that query , i want to find all the other pages that have the -zoom property that contains the title or alias of the page that goes the query
you are good on this bro.
The second one works, is querying correct , i just have one doubt on the way the information is returning
I see that you use in the query,
[:find (pull ?p [*])
but it is returning me the block instead of the page name, why ? i though the ?p would return me only the page name (that is what im seeking)