AEM SQL2 query to get couple of properties on multiple nodes

Avatar

Avatar

kalyan_chakrav1

Avatar

kalyan_chakrav1

kalyan_chakrav1

19-06-2019

Hi,

As a requirement i need to read the tags from the page. On the page we have authored multiple components, so we need to read the couple of properties which are tags on the page and the components which we authored on the page. Could you please help on the SQL2 query/XPath query.

Thanks & Regards,

Kalyan

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838
Arun_Patidar
MVP

24-06-2019

Hi,

Please find XPath Query to find node if tag exists. further, you can get the path and read the properties using ValueMap or node API

(/jcr:root/content/we-retail//element(*, cq:PageContent)

[

(@cq:tags)
] | /jcr:root/content/we-retail//element(*, nt:unstructured)[(@cq:tags)])
order by @jcr:score descending

Answers (3)

Answers (3)

Avatar

Avatar

aemmarc

Employee

Avatar

aemmarc

Employee

aemmarc
Employee

20-06-2019

All Pages under /content that have cq:tags set (eg not null)

select * from [cq:Page] as page where page.[jcr:content/cq:tags] is not null and ISDESCENDANTNODE([/content])

Avatar

Avatar

hamidk92094312

Employee

Avatar

hamidk92094312

Employee

hamidk92094312
Employee

20-06-2019

The JCR Query Cheat Sheet can help you. It includes useful samples: https://wiki.magnolia-cms.com/display/WIKI/JCR+Query+Cheat+Sheet

Avatar

Avatar

kalyan_chakrav1

Avatar

kalyan_chakrav1

kalyan_chakrav1

23-06-2019

Hi,

I need one property on cq;PageContent and other property on its childnode which is nt;unstructured type. Could you please help me on the SQL2 query.

Thanks & Regards,

Kalyan