Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
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