Lesson 5: How to Power Your Workflows Using Properties and Dynamic Variables

So that’s not how queries work actually.
As shown at the start of my post:

We don’t have access to properties defined in child blocks.

The query you posted would ask in plain English:

  • Give me the block that
    • has the property amendment-in with value Central Goods and Services Tax Act, 2017 (CGST Act)/SCHEDULE I
    • and has the property para with value 4
    • and has the property effective-period with value Jul 1st, 2017 to Jan 31st, 2019

There is no such block in your data and so your query returns nothing.
Your exact question can only be solved with advanced queries and would be something like this.

  • Give me the parent block that
    • has a child block with
      • the property amendment-in with value Central Goods and Services Tax Act, 2017 (CGST Act)/SCHEDULE I
      • and the property para with value 4
    • and a child block with
      • the property effective-period with value Jul 1st, 2017 to Jan 31st, 2019
1 Like

But, when the query is set to call:
Give me the block that has

  • the property amendment-in with value Central Goods and Services Tax Act, 2017 (CGST Act)/SCHEDULE I
    AND
  • the property para with value 4

=> It returns the parent block (even when the properties set in its 1st child block).

The issue only arrises when we call a parent block by quering properties from multiple child blocks (and not only from first child block).

This is a false observation probably.

The blue arrow in the screenshot is the query result. The red arrow is the breadcrumbs the query will show with the result.

If we outdent the child block, it looks like this:

If we were to make a child block beneath it, we see what an actual parent - child relationship looks like as a query result:

Hopefully this will help clear up some things.

1 Like

FOA, thank you for explaining in such detail.

But still unable to understand that when we are able to call a child with its properties then why can’t we use AND operator (in the query) to call 2 childs as a result and then the breadcrumbs will be that parent block.

1 Like
  • Because it isn’t
    • I want to get child a AND child b
  • Instead it is
    • I want to get all the blocks that match condition a AND condition b
    • and the query then returns all those blocks
      • it will display not the parent specifically, but the breadcrumbs leading to that block.

To illustrate that last point:

(Yeah I’m on my phone now lol)

1 Like

Wonderful, now understood. How foolish I talked. :joy:

My query is asking to give birth to a new child block by combining 2 child blocks and that’s not possible and I am assuing that breadcrumbs as that new child. That’s why you mentioned “There is no such block in your data and so your query returns nothing.”

So, technically logseq query understands everything as a block and didn’t differentiate between parent block and child block.

Also, to get multiple child blocks in result, we should use OR operator instead.

Thanks!! :slightly_smiling_face:

2 Likes