Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,606
Community Members
 
Community Events
168
Community Groups

xPorter template filter on labels

Hi Community!

I have a xPorter template I have been asked to created. The Criteria are:

1 - Retrieve a list of all issues of type "A" with a status other than "Won't Do".

2 - For each issue on that list, populate the template with the issue AND

2a. populate the template with each Link to the issue when the Linked Issue is:

Type "B" AND status other than "Won't Do" AND does not have the label "OMIT"

I can do a straight query of Jira for the first Condition:

Project = ABC and type = "A" and status not in ("Won't do") and labels not in ("OMIT") ORDER BY key ASC

And I put this in the Template (It goes into a Word Table:

&{for issues}


#{for oks=LinksCount|filter=%{'${Links[oks].IssueType}'.equals('B') && !'${Links[oks].Status}'.equals('Won\'t Do') && !'${Links[oks].Labels}'.equals('OMIT')}}

${Source}  ${Key}  ${Summary}  ${Links[oks].Key}  ${Links[oks].Summary}

#{end}

&{end}

I think the .equals('OMIT') is wrong,... Because I have many labels on these issues (and some where Labels are EMPTY.

 

Has anyone successfully excluded content based on a label? If so, where am I missing it?

(Oh, and Yes. Still very new, I don't even know what this language is called.)

 

1 answer

1 accepted

1 vote
Answer accepted
Mikael Sandberg Community Leader Sep 09, 2022

When you add fields like labels to your JQL you also have to cover the case when label is empty or those will be excluded too. So something like this should do it:

(labels != OMIT OR labels is EMPTY)

Thank you, Excellent Point. 

The trickiness (for me) is that I use the JQL to obtain the 'parent' issues, and I use xPorter filter statement to return the issues linked to that 'parent' issue.

So, I would have to place this OR within the filter statement in the xPorter template.

 

For those that follow, my main error was using .equals rather than .contains 

 

Here's the statement that (I think) worked (includes issues without labels):

#{for trqs=LinksCount|filter=%{'${Links[oks].IssueType}'.equals('B') &&!'${Links[oks].Status}'.equals('Won\'t Do') && (!'${Links[oks].Labels}'.contains('NotInSRS') || '${Links[oks].Labels}'.contains(null))}}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events