Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Need to identify a query based on the property availability

Avatar

Level 4

I'm using AEM 6.5.11. Can someone help me with a XPATH query that could give me the list of pages which has the particular property inside a particular node.

 

Below are details;

Page node: /content/sample-bank/personal/form
Type: cq:Page
property name: eventscript
property type: String

 

Please find the below screenshot - I want to get the list of pages under content path /content/sample-bank/personal/form, eventscript is one of the property in container node as shown below.

 

samsundar23_1-1675096367202.png

 

Note: There are 1000 of subpages under the cq:Page /content/sample-bank/personal/form which could have or don't have the property eventscript in the node /jcr:content/content/container

 

Kindly help. Thanks in advance.

 

Thanks
SHYAMSUNDAR TK

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I tried the similar sample query in we.retail also, its working for me.

type=cq:Page
path=/content/we-retail/us/en/products/men
property=@jcr:content/image/fileReference
property.operation=exists
p.hits=full
p.limit=-1

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @samsundar23 

Could you please try this below query in debugger and see if brings the results. 

 

type=cq:Page
path=/content/sample-bank/personal/form
property=@jcr:content/content/container/eventscript
property.operation=exists
p.hits=full
p.limit=-1

Avatar

Level 4

@Saravanan_Dharmaraj  - This is not giving me the list of pages bro. Basically, eventscript is available as one of the property in the container node as shown below.

 

samsundar23_0-1675097632989.png

 

 

Avatar

Correct answer by
Community Advisor

I tried the similar sample query in we.retail also, its working for me.

type=cq:Page
path=/content/we-retail/us/en/products/men
property=@jcr:content/image/fileReference
property.operation=exists
p.hits=full
p.limit=-1

Avatar

Employee Advisor

Could you please one of the query below and let me know if it works -

Option:1

path=/content/we-retail/language-masters/en
type=cq:Page
property=jcr:content/content/container/eventscript
property.operation=exists
p.limit=-1
XPath query
/jcr:root/content/we-retail/language-masters/en//element(*, cq:Page)
[
(jcr:content/content/container/@eventscript)
]

 

Option2:

path=/content/we-retail/language-masters/en
nodename=container
property=eventscript
property.operation=exists
p.limit=-1

 

XPath query
/jcr:root/content/we-retail/language-masters/en//*
[
(fn:name() = 'container' and @eventscript)
]

 

Regards,

Debal