filterByCardinality()

Number list

This function filters a number list by the list elements' cardinality (how often they appear in the list) using the given comparison.


Bash
filterByCardinality(numberList, operator, number) #Output: Number list


Examples

Parser expression

Description

Bash
filterByCardinality([anyNumberList], >, 1) 

In this example a number list with those elements would be returned, that occurred more than once in the number list.

Bash
filterByCardinality([1, 1, 2, 3, 4, 4, 4, 5], >, 1) 

This example returns

[1, 4]

since 1 and 4 are occurring more than once in the list.

Bash
filterByCardinality([1, 1, 2, 3, 4, 4, 4, 5], =, 1) 

This example returns

[2, 3, 5]

since these values are occurring exactly once in the list.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

numberList

number list

Any given number list.

operator

operator

One of the following comparison operators: =, !=, <, <=, > and >=.

number

number

Any given number that will be used in combination with the operator to filter the given list.

Output

This function returns a number list .

If the number list is empty or the comparison won't be fullfilled by any element, the function returns an empty  number list .


Text list

A variant for text lists.


Bash
filterByCardinality(textList, operator, number) #Output: Text list


Examples

Parser expression

Description

Bash
filterByCardinality(["tiger", "tiger", "tiger", "lion", "lion", "cat", "lynx"], <, 3) 

This example returns

["lion", "cat", "lynx"]

since these elements are occurring less than 3 times in the list.

Bash
filterByCardinality(fieldValue(%{issue.component}, subtasks()), =, count(subtasks()))


This example returns a text list with those Components who are present in all sub-tasks.

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

textList

text list

Any given text list.

operator

operator

One of the following comparison operators: =, !=, <, <=, > and >=.

number

number

Any given number that will be used in combination with the operator to filter the given list.

Output

This function returns a text list .

If the number list is empty or the comparison won't be fullfilled by any element, the function returns an empty  text list .


Issue list

A variant for issue lists.


Bash
filterByCardinality(issueList, operator, number) #Output: Issue list


Examples

Parser expression

Description

Bash
filterByCardinality(linkedIssues(), >, 1)

This example returns an issue list with all issues that are linked to the current issue more than once.

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

issueList

issue list

Any given issue list. Usually this value is retrieved from a function (e.g. 

linkedIssues()

or 

subtasks()

).

operator

operator

One of the following comparison operators: =, !=, <, <=, > and >=.

number

number

Any given number that will be used in combination with the operator to filter the given list.

Output

This function returns an issue list .

If the number list is empty or the comparison won't be fullfilled by any element, the function returns an empty  issue list .


📚 Use cases and examples