Query pages with multiple pages properties

Hi everyone,

I’m trying to create an advanced query to search for pages that have two specific page properties. The query works as a simple query, but I do not get any results when trying to turn it into an advanced query.

So basically I created a page property “type” which can be either “person” or “organisation”. There’s also another property called “group” which could e.g. be “Civil Society/NGOs”.

I want to filter for pages that have both the type organisation and also the group Civil Society/NGOs. this works as a simple query, but I cannot get it to work as an advanced query.

Does someone have a suggestion on how to get there? Thanks a lot in advance!

What would be your goal with an advanced query? In other words, what is lacking for the use of the simple query?
We can use the simple query syntax in advanced queries btw.
See this example:
As well as this one using block properties:
For page properties it would be
(page-property ?p :type "organization")

So you get a :where of
(and (page-property ?p :type "organization") (page-property ?p :group "Civil Society/NGOs") )
Which should be similar to your simple query.

This works, thank you so much for your help! I probably didn’t put the parentheses where they need to be for a proper and clause. I also didn’t know one could use simple query syntax in advanced queries, that’s very helpful.

Basically I wanted to use the advanced query to get rid of the “live query” thingy that pops up above the query now.

One more question: I am using this as an overview for organisations from e.g. Civil Society/NGOs. So I am using the query on the page “Civil Society/NGOs” and would make use of the <%current page%> syntax, since I created a template for the query to quickly use it. However, when I use simple query syntax in an advanced query like this:

{:title [:h3 “Organisations”]
:query (and (page-property :group <%current page%>) (page-property :type “organisation”))

and then embed the block with the query on another page (e.g. “Civil Society”) the query uses this new page as its <%current page%> input, but I still want it to use “Civil Society/NGOs”. => I remember using [:query-page] instead, but I am struggling with the syntax (and I feel like this would only work with a “real” advanced query syntax.

Thanks again for your help and your amazing work!

Nevermind, it works when I insert the query on a new page with a template, then it automatically converts the <%current page%> tag to the current page

1 Like