Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

Query to return all component group using JCR-SQL2

Avatar

Level 3

I would like to write a query using JCR-SQL2 to return all component groups. 

wenwang1_0-1684199667548.png

 

I tried the following but it is not returning anything:

SELECT * FROM [componentGroup] 

 

Does anyone have any suggestions? Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@aemUser2345 ,

You have to modify your query a bit, 'componentGroup' is not a valid node type

Use the below query to get the valid nodes 

SELECT 'componentGroup' FROM [cq:Component]

 

add a WHERE ISDESCENDANTNODE clause if you want to get component groups under a specific path

In your code then, you can get the value of 'componentGroup' property if required


View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@aemUser2345 ,

You have to modify your query a bit, 'componentGroup' is not a valid node type

Use the below query to get the valid nodes 

SELECT 'componentGroup' FROM [cq:Component]

 

add a WHERE ISDESCENDANTNODE clause if you want to get component groups under a specific path

In your code then, you can get the value of 'componentGroup' property if required