User Macro: Search for multiple labels

Hi everyone! Within my macro (contentbylabel), I want to search for content with multiple labels. They should not only have a one specific, but two specific labels. Right now, adding another "AND" to the syntax does not work.

Does anyone have a clue how to solve this problem?

Thanks in advance!
Marcel

<ac:macro ac:name="expand">
<ac:default-parameter>$title</ac:default-parameter>
<ac:rich-text-body>
<ac:structured-macro ac:name="contentbylabel" ac:schema-version="2">
<ac:parameter ac:name="showLabels">false</ac:parameter>
<ac:parameter ac:name="cql">label = "$topic"</ac:parameter>
</ac:structured-macro>
</ac:rich-text-body>
</ac:macro>

1 answer

1 accepted

1 vote
Stephen Deutsch Community Champion Jan 19, 2018

Hi Marcel,

I think the syntax for your CQL would be "label = <label1> AND label = <label2>". If you want to include multiple labels, you could have the parameter be a comma separated list, and then you could split based on the comma and do a foreach loop where you do string + "AND label = " + label, and then use a substring to remove the first AND from the string.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

900 views 23 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you