How to query page by property value and in table view?

I want query the page whose property value is the current page title and try to display other properties in table view.
Can anyone tell me how to query a page by its property value? :pleading_face:
I’ve made some attempts and they were all poorly done:

  1. according to Official Help Doc - 6. All pages have a “programming” tag code example, the results can not display other properties of the page in table.
  2. simple query can not query the values wrapped in quotes or values with spaces in the middle.

Can anyone tell me how to query a page by its property value?

{{query (property dummyproperty "this is a value")}}

query the page whose property value is the current page title

As far as I can see, this is possible when you simply use the name of the current page. The dynamic variable <% current page %> normally works in queries, but not when the page name contains spaces. Wrapping it in quotes does not work either. I am guessing this prevents it from being expanded.

So to be clear the following does not work:

{{query (property dummyproperty "<% current page %>")}}
{{query (property dummyproperty <% current page %>)}}

I tried to work around this by making the not-working-examples above into a template. Unfortunately, this also doesn’t work as the dynamic variable gets expanded like this [[page title]]. The brackets prevent it from working.

I’m afraid this will require an advanced query.

Trying to do something similar and display it as a table along with other page properties. Querying for page-tags works fine, but querying property key value returns a list of blocks and not specifically pages that have that key value.

Any ideas? Is it even possible?

Yes, page-tags works well. Now I just use tags:: instead of customized page property name.
Here is query code I am using, I guess there may be some way to replace ?tag with users’ property name.

#+BEGIN_QUERY
{:title [:h2 "All Movies & Dramas"]
 :query [:find (pull ?p [*])
 		:in $ ?tag
		:where
        [?t :block/name ?tag]
        [?p :block/tags ?t]
        [?p :block/name ?name]]
:inputs [:current-page]}
#+END_QUERY
1 Like