sort()

Number list

This function sorts a given number list in a specified order. Available orders are ASC (for ascending order) and DESC (for descending order).

Bash
sort(numberList, order) #Output: Number list

Examples

Parser expression

Description

Bash
%{sort([2, 4, 3, 5, 1], ASC)}

This example returns

[1, 2, 3, 4, 5]

Bash
%{sort(toNumberList(%{issue.description}), DESC)}

This example returns a number list in the description sorted by descending order:

[4, 3, 2, 1, -6]

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

numberList

NUMBER LIST

Any given number list.

order

TEXT

Available orders are ASC (for ascending order) and DESC (for descending order).

Output

This function returns a number list


Text list

Variant for text lists.

Bash
sort(textList, order) #Output: Text list

Examples

Parser expression

Description

Bash
%{sort(["red", "blue", "green"], ASC)}

This example returns

["blue", "green", "red"]

Bash
%{sort(toStringList(%{issue.components}), DESC)}

This example returns a  text list of the components of the current issue sorted in descending order, e.g. 

["UX", "UI", Cloud"]

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.

order

TEXT

Available orders are ASC (for ascending order) and DESC (for descending order).

Output

This function returns a text list


Issue list

Variant for issue lists.

The list is sorted by Issue key. Available orders are ASC (for ascending order) and DESC (for descending order).

Bash
sort(issueList, order) #Output: Issue list

Examples

Parser expression

Description

Bash
sort(linkedIssues("is blocked by"), ASC)

This example returns an issue list of issues blocking current issue, sorted in ascending order by their Issue key.

To achieve this, the following functions are used:

Bash
sort(subtasks(), ASC)

This example returns an issue list of sub-tasks, sorted in ascending order by their key.

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()).

order

text

Available orders are ASC (for ascending order) and DESC (for descending order).

Output

The function returns an issue list


(books) Use cases and examples