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!
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:
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.
Finally after hours of digging into the forums. Thanks for sharing this. Somehow using the :current-page syntax didn’t work for me when trying to get pages with a property equal to the current page.