QueryBuilder Query help

Avatar

Avatar

cprogramkarthic

Avatar

cprogramkarthic

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)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
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)

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

22-03-2019

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

Avatar

Avatar

cprogramkarthic

Avatar

cprogramkarthic

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

Avatar

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281
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/

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
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.

Avatar

Avatar

cprogramkarthic

Avatar

cprogramkarthic

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.

Avatar

Avatar

MatthewLaun

Employee

Avatar

MatthewLaun

Employee

MatthewLaun
Employee

21-03-2019

Karthick,

Have you already referred to the Query Builder API ?

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

21-03-2019

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?