How to query current node as well as its descendant nodes? | Community
Skip to main content
Level 3
Jul 25, 2023 11:00 PM UTC
Solved

How to query current node as well as its descendant nodes?

Is there any way to query on the current node as well as its descendant nodes based on the below query? I also want to check whether the current node has [jcr:content/cq:lastReplicationAction] = 'Activate'

SELECT DISTINCT page.[jcr:path] FROM [cq:Page] AS page WHERE ISDESCENDANTNODE(page, '/content/') AND page.[jcr:content/cq:lastReplicationAction] = 'Activate'

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Shiv_Prakash_Patel
Shiv_Prakash_PatelAccepted solution
New Participant
Jul 26, 2023 3:03 AM UTC

Hi @aemuser2345,

You can try SQL2 query as suggested by @briankasingli .

If you want to use QueryBuilder, Please try this.

path=/content/ type=cq:Page property=jcr:content/cq:lastReplicationAction property.value=Activate path.self=true p.limit=-1

Regards,

Shiv

 

Shiv Prakash

3 replies

Shiv_Prakash_Patel
Shiv_Prakash_PatelAccepted solution
New Participant
Jul 26, 2023 3:03 AM UTC

Hi @aemuser2345,

You can try SQL2 query as suggested by @briankasingli .

If you want to use QueryBuilder, Please try this.

path=/content/ type=cq:Page property=jcr:content/cq:lastReplicationAction property.value=Activate path.self=true p.limit=-1

Regards,

Shiv

 

Translate
Shiv Prakash
BrianKasingli
New Participant
Jul 26, 2023 1:01 AM UTC

Try this

 

SELECT page.[jcr:path] FROM [nt:base] AS page WHERE ISDESCENDANTNODE(page, '/content/') AND page.[jcr:content/cq:lastReplicationAction] = 'Activate'

 

Translate
Level 3
Jul 26, 2023 8:53 PM UTC

sorry for this query I am still getting the descendant nodes, and unable to get the current node.

Translate