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

Sling Model Multivalue Page level property reading

Avatar

Avatar
Ignite 1
Level 3
khamat_bn
Level 3

Likes

31 likes

Total Posts

54 posts

Correct Reply

12 solutions
Top badges earned
Ignite 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Ignite 1
Level 3
khamat_bn
Level 3

Likes

31 likes

Total Posts

54 posts

Correct Reply

12 solutions
Top badges earned
Ignite 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile
khamat_bn
Level 3

08-06-2020

Hello Guys,

I want to read the property of page level cq:tags which will be multivalue. If I trying to read the property by 

pageNodes.getProperty("cq:tags").getValue().toString()

its saying cq:tags is multivalue. can anyone tell me how i can read this property.

 

Regards,

~BK

 

AEM Sling Model

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 1
Level 3
khamat_bn
Level 3

Likes

31 likes

Total Posts

54 posts

Correct Reply

12 solutions
Top badges earned
Ignite 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile

Avatar
Ignite 1
Level 3
khamat_bn
Level 3

Likes

31 likes

Total Posts

54 posts

Correct Reply

12 solutions
Top badges earned
Ignite 1
Give Back 3
Give Back
Boost 5
Boost 3
View profile
khamat_bn
Level 3

09-06-2020

Hello @a74048191r ,

Thanks for the response, I tried the lines that u posted. Unfortunately, it didn't work for me.

But I ended up with the solution that works for me. Posting Here so others can also use it if required.

private Value[] tagsFromPage;

for
(Value eachTag : tagsFromPage) {
log.info("tagsFromPage value: {}", eachTag.toString());
}

 

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 2
a74048191r
Level 2

Likes

6 likes

Total Posts

17 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Ignite 1
Give Back
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 2
a74048191r
Level 2

Likes

6 likes

Total Posts

17 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Ignite 1
Give Back
Boost 5
Boost 3
View profile
a74048191r
Level 2

08-06-2020

try this:

Value[] values = pageNodes.getProperty("cq:tags").getValues();
 
then iterate as needed

                for (Value value : values) {
                    Tag tag = tagManager.resolve(value.getString());
                }