QueryBuilder Query help | Community
Skip to main content
Level 2
March 21, 2019
Solved

QueryBuilder Query help

  • March 21, 2019
  • 8 replies
  • 5051 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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

8 replies

smacdonald2008
Level 10
March 21, 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?

Adobe Employee
March 21, 2019

Karthick,

Have you already referred to the Query Builder API ?

Level 2
March 21, 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.

smacdonald2008
Level 10
March 21, 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 Coral 3

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.

Gaurav-Behl
Level 10
March 21, 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/

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
March 21, 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%'

Arun Patidar
Level 2
March 22, 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

smacdonald2008
Level 10
March 22, 2019

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