Hi there,
I want to list all the blocks from my journal that contain hashtags x, z, y but not older than 2 weeks
I am trying but I just can’t make it work… maybe someone else can spot the mistake.
In this snippet, I am using “personal-feedback” as one of the hashtags
#+BEGIN_QUERY
{
:query [
:find (pull ?h [*])
:in $ ?start ?today
:where
[?h :block/page ?p]
[?h :block/path-ref ?ref]
[?p :page/journal-day ?d]
[?ref :block/name "personal-feedback"]
[(>= ?d ?start)]
[(<= ?d ?today)]
]
:inputs [:14d-before :today]
:collapsed? false
}
#+END_QUERY
Ok so I am not the expert here. Also I’m at my phone so can’t test it properly but I believe you can just duplicate the line with the ?ref variable.
In practice you can just add a couple of lines to state it should equal other values as well.
[?ref :block/name "personal-feedback"]
[?ref :block/name "personal-improvement"]
[?ref :block/name "justice-for-kittens"]
Apologies if I’m remembering it wrong 
Each different value should have its own variable, e.g.:
[?h :block/path-refs ?ref1]
[?h :block/path-refs ?ref2]
[?h :block/path-refs ?ref3]
[?ref1 :block/name "personal-feedback"]
[?ref2 :block/name "personal-improvement"]
[?ref3 :block/name "justice-for-kittens"]
- What does work partially so far?
- What is returned or not returned from this query or from earlier attempts?
- What blocks fail the filter?
- They should appear but they don’t.
- They should not appear but they do.
- Do you use
:block/path-ref
and :collapsed?
consciously or are they “random” ideas from other queries?
1 Like
I am now debugging and noticed that the :block/name already doesn’t work for me…
#+BEGIN_QUERY
{
:query [
:find (pull ?h [*])
:where
[?h :block/page ?p]
[?h :block/path-ref ?ref]
[?p :page/journal-day ?d]
[?ref :block/name "personal-feedback"]
]
:collapsed? false
}
#+END_QUERY
this is what I have right now but it doesn’t provide any results.
I have set up a few tests in journal pages where I just wrote “personal-feedback” “[[personal-feedback]]” but none of them get picked up. also indents shouldn’t matter no? I have some of these test-contents on top level and some as indents.
Do you use :block/path-ref
and :collapsed?
consciously or are they “random” ideas from other queries?
random ideas I think 
Correct :block/path-ref
to :block/path-refs
(or just :block/refs
for that matter).
I actually got it to work with a different syntax:
{{query (and (and [[xyz]] [[personal-feedback]]) (between -2w today))}}
This syntax is from the query click editor. Whats the deal with the two different query syntax options? is one of them legacy?