I’m having a more difficult time than I thought I would have trying to create this query. I have been organizing contacts under their respective namespaces (e.g. Company X/Joe Smith
) and assigning a property type:: person
. The query I’d like help getting to work would list all blocks with property type
equal to “person” under the namespace “Company X”.
The query I have thus far just lists all blocks with property type
equal to “person”. I can’t figure out how to specify the namespace “Company X” and have blocks return in the result. Am I missing something super simple?
#+BEGIN_QUERY
{
:title [:h2 "employees"]
:query [
:find (pull ?b [*])
:where
(or-join [?namespace ?b]
(and ; does block page belong to namespace?
[?b :block/page ?page]
[?page :block/namespace ?ns]
[?ns :block/original-name ?namespace]
))
(property ?b :type "person")
]
}
#+END_QUERY
Edit:
go figure after creating a post I think I figured it out
#+BEGIN_QUERY
{
:title [:h2 "employees"]
:inputs ["Company X"]
:query [
:find (pull ?b [*])
:in $ ?namespace
:where
(or-join [?namespace ?b]
(and ; does block page belong to namespace?
[?b :block/page ?page]
[?page :block/namespace ?ns]
[?ns :block/original-name ?namespace]
))
(property ?b :type "person")
]
}
#+END_QUERY