Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

User macro for counting multiple labels on pages Edited

tvdsluijs I'm New Here May 07, 2021

I've got this piece of code to count pages with a certain label in a certain space

## To count labels
## @param Label:title=Label|type=string|required=true|desc=Enter a label to count.
## @param Spaces:title=Space|type=string|required=false|desc=This Key is case-sensitive. Only for use in one single space. Example: SPACEKEY

#set( $labelManager = $action.LabelManager )
#set( $labRef = $labelManager.getLabel($paramLabel) )
#set( $pages = $labelManager.getCurrentContentForLabelAndSpace($labRef, $paramSpaces) )

$pages.size()

 I would really like to filter on, multiple labels (in AND and OR) anyone knows how?

Any help is appreciated

Thank you.

 

1 answer

0 votes
Dominic Lagger Community Leader May 10, 2021

Hi @tvdsluijs 

I know the answer for the "AND", but not for the "OR"

#set( $list = $labelManager.getContentInSpaceForAllLabels(0, 10, $paramSpaces, $labRef, $labRef2)) 

See documentation.

With this statement, you get a list of all pages in the space with the labels from $labRef AND $labRef2. Because it's this type of parameter (Label... labels) you can add as much labels you want.

The only thing I can imagine for "OR" would be to search with CQL, but this is a bit tricky (Don't know how)

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Miss the Confluence demos at Team 21? Watch them here!

Phew, Atlassian Team 2021 blew by. With dozens of demos and a handful of keynotes, you may have missed some of the awesome Confluence Cloud sessions. Don't' worry, you can watch them all here or on Y...

309 views 2 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you