I’ve got a template to capture information for items that I want to read. I capture my readings in my journal using a template that contains a variety of block properties. I’m trying to query based on a block property I created called type. I created a separate page for readings. I’m trying to query all readings with type = “report”. Unfortunately, nothing I do appears to work. Here’s an example of a completed version of the template:
Preparing and Linking Administrative Data: Promising Practices and Lessons Learned from the Child Maltreatment Incidence Data Linkages Project title:: Preparing and Linking Administrative Data: Promising Practices and Lessons Learned from the Child Maltreatment Incidence Data Linkages Project type:: report**
author**:: Tara Strelevitz and Claire Smither Wulsin publisher:: Office of Planning, Research, and Evaluation, Administration for Children and Families, U.S. Department of Health and Human Services. date published:: pages:: 5 ID number:: link:: Preparing and Linking Administrative Data: Promising Practices and Lessons Learned from the Child Maltreatment Incidence Data Linkages Project (mathematica.org) subject:: DataLinking date:: [[2022-07-22]] status:: Unread tags::
I’ve tried a simple query: {{query (property type report)}}
I’ve also tried an advanced query:
#+BEGIN_QUERY
{
:title [:h2 “Reports to read”]
:query [:find (pull ?b [*])
:where
[?b :block/properties ?p]
[(get ?p :type) ?t]
[(= “report” ?t)]]
}
#+END_QUERY
I’ve tried “report” both with and without quotes. When I run the query, I get 0 results. Could somebody help me with this query? I don’t know what the problem is. I don’t even know if the query is the cause of the problem or if something is wrong with the property.
Also, have a look at the block with an external editor, I had a lot of issues because a hidden logbook entry was in one of my templates, that you only see outside Logseq
I copied the note into Notepad++. It doesn’t show many of the fields. I don’t know why. Here’s what I get from Notepad++:
Preparing and Linking Administrative Data: Promising Practices and Lessons Learned from the Child Maltreatment Incidence Data Linkages Project date published:: ID number::
That’s a lot less than the actual block.
I don’t know if this is related, but I’m running into a problem with my template page. I’m trying to create a template and getting a block render error, see below:
I discovered the problem. Not only is Logseq case sensitive, it also includes the formatting characters in the property name. I bold the properties (e.g., type) in the note, but not in the query. When I remove the bold from the note or add the “**” to the query, both the simple and advanced queries works.
It seems obvious with 20-20 hindsight that markdown’s formatting characters would be part of the property name. Unfortunately, I didn’t think about it when I was debugging my query.
Thanks again for your help, and please keep making with your videos! Even when I don’t learn something new about Logseq, seeing your workflow is thought-provoking and helps me improve mine!
Happy to hear you found the solution while I was being occupied.
I’ll keep making video’s, love doing that thanks for the kind words, enjoy searching for all your tags.