Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Fetch the list of values for a field

Avatar

Avatar
Level 1
appleb75315648
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
appleb75315648
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
appleb75315648
Level 1

05-06-2018

Hi Team,

  I'm new to the Experience Manager and JCR repository. I have to implement a JCR Query to fetch the values from a content node.

  Example: The content folder under several nodes.

                 /content/folder1/folder2/data1,  /content/folder1/folder2/data2 with some properties inside it.

                 The data under folder2 in json format looks in this way:

{

"sling:resourceType": "xyz/exp-manager",

"jcr:primaryType": "xyz:adobe",

"test": "hi",

"list": {

   "0": {

     "ids": [],

     "sling:resourceType": "xyz/list",

     "jcr:primaryType": "nt:unstructured"

       },

    "jcr:primaryType": "nt:unstructured"

},

"adobe": {

"text1": "hello,

}

}

In this way i have several folder under content. Now I have to implement a query to fetch the id's available under list node in all the folders.

Is this possible to achieve it. Please help in resolving it.

Thanks,

Varun.

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2018

Once you query the list node, you can read the ID property by using syntax to read an Array.

Once you get the node that contains this property - you can get the array by using this JCR API code;

Property references = node.getProperty("id"); 

Value[] values = references.getValues();

String myId = values[0].getString();

Hope this helps...

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2018

As you are new to AEM - read this article on how to use QueryBuilder API -- Adobe Experience Manager Help | Creating Adobe Experience Manager OSGi bundles that use the Query Bu...