Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

QueryBuilder Query help

Avatar

Level 2

Hi,

I want to find all the components that have a nested multifield in the touch ui dialog in AEM 6.4. Kindly help with writing a query for it that can be executed in Query Builder.

I have written a below query to find out all the components that have a multifield. But not sure how to find out a sub node that has a sling:resourceType of "granite/ui/components/coral/foundation/form/multifield".

type=nt:unstructured

path=/apps/

1_property=sling:resourceType

1_property.value=granite/ui/components/coral/foundation/form/multifield

p.limit=-1

Kindly help with the same. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You have to do it with SQL2

Below is the Query but make sure, it would be time taken, so run on specific folders rather than on complete apps

SELECT parent.* FROM [cq:Component] AS parent

INNER JOIN [nt:unstructured] AS child

ON isdescendantnode(child,parent)

INNER JOIN [nt:unstructured] AS gc

ON isdescendantnode(gc,child)

WHERE ISDESCENDANTNODE(parent, '/apps/AEM63App')

AND child.[sling:resourceType]  like '%granite/ui/components/coral/foundation/form/multifield%'

AND gc.[sling:resourceType]  like '%granite/ui/components/coral/foundation/form/multifield%'



Arun Patidar

View solution in original post

8 Replies

Avatar

Level 10

What are you trying to do here - if you get a result set of certain components - what are you going to do with the data?

Avatar

Level 2

Karthick,

Have you already referred to the Query Builder API ?

Avatar

Level 2

There is an issue with customized multifield js in project. I just want to find out the list of all the components with nested multi fields available in my project to make sure they all work fine. But don't want to do it manually by checking each and every component.

Avatar

Level 10

A nested multifield has a specific node pattern for the dialog. I recommend that you look here for that pattern.

It has an outer and then inner pattern - as discussed here:

Experiencing Adobe Experience Manager - Day CQ: AEM 64 - Touch UI Nested Composite Multifield Using ...

Now you can query for all outer ones. Put the result set in a collection in Java code - an ArrayList purhaps. Then go through that result set - search to find the inner one. That is your best way i can think of.

Avatar

Level 10

You may try with SQL2 otherwise with QB try this --

1_property=sling:resourceType

1_property.value=granite/ui/components/coral/foundation/form/multifield

2_property=*/ */sling:resourceType   // find nth level depth based on your use case

2_property.value=granite/ui/components/coral/foundation/form/multifield

property.and=true

(@jcr:title = 'foo' or */@jcr:title = 'foo' or */*/@jcr:title = 'foo' )  or use property.depth

https://hashimkhan.in/aem-adobecq5-code-templates/query-builder/

Avatar

Correct answer by
Community Advisor

Hi,

You have to do it with SQL2

Below is the Query but make sure, it would be time taken, so run on specific folders rather than on complete apps

SELECT parent.* FROM [cq:Component] AS parent

INNER JOIN [nt:unstructured] AS child

ON isdescendantnode(child,parent)

INNER JOIN [nt:unstructured] AS gc

ON isdescendantnode(gc,child)

WHERE ISDESCENDANTNODE(parent, '/apps/AEM63App')

AND child.[sling:resourceType]  like '%granite/ui/components/coral/foundation/form/multifield%'

AND gc.[sling:resourceType]  like '%granite/ui/components/coral/foundation/form/multifield%'



Arun Patidar

Avatar

Level 2

Able to get the list of nested multifield components quickly with Arun's suggestion. Thanks smacdonald2008, MatthewLaun, gauravb10066713 and Arun Patidar. All of your replies helped to learn something new

Avatar

Level 10

I am happy you got it working. This thread shows the entire purpose of the AEM community.