QueryBuilder Query help

cprogramkarthic

21-03-2019

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.

Accepted Solutions (1)

Accepted Solutions (1)

Arun_Patidar

MVP

21-03-2019

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%'

Answers (7)

Answers (7)

cprogramkarthic

21-03-2019

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

Gaurav-Behl

MVP

21-03-2019

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/

smacdonald2008

21-03-2019

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.

cprogramkarthic

21-03-2019

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.