Querying children of a specific block with simple syntax

I still find the advanced query syntax pretty opaque and haven’t been able to spend the time to learn it, so I’m trying to accomplish this with the basic query syntax.

I want to make a simple table of blocks under a specific parent, and what I’m going for is something like this:

{{query (and (property parent "66b22aa8-7a0d-4f21-99c1-85fe24cf97bc") (property severity "error"))}}

However, when I do this, I always get no results. If I remove the and clause and query only on the parent property, I still get nothing. What am I doing wrong?

Querying for direct children sounds strange. Could you share some example notes?

I can’t copy/paste my actual notes for a couple of reasons (IT policies, blah blah), but here’s a representative example:

 - Records
    - name:: RecordName
      priority:: normal
      source:: [nice text](ugly url)
      anotherUrl:: just.a.url.com
    - name:: Another Record
      priority:: high
      source:: [nice text](ugly rul)
      anotherUrl: unformatted.com

this block and it’s children could be anywhere in the graph (and the query could be anywhere else), but in my query, I don’t want to get any random block that might have a :priority property. I only want to query these specific blocks (and in the real note, there are dozens, not two)

Why to query the children, instead of referencing the block itself, i.e. with ((66b22aa8-7a0d-4f21-99c1-85fe24cf97bc))?

hmm…ok, if I query the parent directly I do get the children, but if I try to add a property to the query, it comes back empty:

{{query "uuid"}} - returns block and children (and parent, for that matter)
{{query (and "uuid" (property name))}} - back to nothing

Update: I think the and clause returns nothing because the parent block I’m querying doesn’t have the properties I’m looking for, so now this seems exactly what I should have expected. The query only returns 1 result, and what I’m trying to do is list all the children of this block in a table

  • There are no built-in properties parent, severity etc.
    • To use those, should provide them in every child.
  • But it is more meaningful to:
    • add a unique tag on the parent
      • e.g. #records
    • then inside (and) combine that tag with the property
      • e.g. {{query (and [[records]] (property name))}}

there are no built-in properties parent

ah, ok. Is there another way to query “children of this specific block” without having to tag the parent?

I don’t think so. Should use an advanced query.

1 Like