How to get block ID from block/properties?

Hi all,

I have a block meeting with property people.

  • This is a meeting
    people:: #Jack

inside the block meeting I want to add a query to find the todo for that person, in this case Jack

I prepare a draft of the Query as below

#+BEGIN_QUERY
{  :title [:h6 [:b "TODO"]]
:query [:find ?prop-value ?prop ?p
:in $ ?parent
:where
[?parent :block/properties ?prop]
[(get ?prop :people) ?prop-value]

]
:inputs [:parent-block]
}
#+END_QUERY

The problem is that the results of the variables are:
?prop = {: people #{“Jack”}}
?prop-value = #{“Jack”}

So I do not get the ID of the page “Jack”, so I do not know how to continue to find the TODO with that ID reference.

Anybody can help?

@Siferiax can you help? :pray:

The problem seems to be the capital letter if I write #jack I can get make it work with the function

[(contains? ?prop-value ...)])

The problem is that for me is not convenient to write jack, since the autocomplete is Jack with the capital.
Is there any function to change the capital to small letter?

I think I resolved:

instead of using

(not [?t1 :block/name ?page]
[(contains? ?prop-value ?page)])

I use

(not [?t1 :block/original-name ?page]
[(contains? ?prop-value ?page)])

In this way recognize the capital letter.
I hope it is not by chance

Thanks @mentaloid
So my solution should work right?

  • I don’t understand what you are trying to solve
    • E.g. what is t1 ?
  • But concerning the capitalization, original-name contains the original capitalization.
    • Values of different capitalization will fail.

I will use the ?t1 variable then to get markers with reference that ?t1. The query is not completed coz I wanted to solve the problem of getting the property right.

So to be sure to get all the case I can use a or condition with name and original-name?

No, this will get only these two cases.

  • These cover most real-life scenarios.
  • To actually get all cases, you need a case-insensitive regex, like the one in the mentioned post of Siferiax.