sublist()

Number list

This function returns a sublist of a given number list by using a start index (first element) and end index (last element).

Bash
sublist(numberList, startIndex, endIndex) #Output: Number list

Examples

Parser expression

Description

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

This example returns

[2, 3, 4]

Bash
%{sublist(toNumberList(%{issue.versions.id}), 1, 2)}

This example returns a distinct number list of both affected and fix version/s id/s of the current issue, e.g. 

[10002, 10000]

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.

startIndex

number

A valid index must be >= 1 and <= count(numberList) which is the maximum number of elements in the list

endIndex

number

A valid index must be >= 1 (and >= startIndex) and  <= count(numberList) which is the maximum number of elements in the list.

Output

This function returns a number list


Text list

Variant for text lists.

Bash
sublist(textList, startIndex, endIndex) #Output: Text list

Examples

Parser expression

Description

Bash
%{sublist(["red", "green", "blue", "purple", "white"], 2, 4)}

This example returns

["green", "blue", "purple"]

Bash
%{sublist(toStringList(%{issue.components}), 1, 3)}

This example returns a distinct text list of the three first components of the current issue, e.g. 

["UI", "UX", "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.

startIndex

number

A valid index must be >= 1 and <= count(textList) which is the maximum number of elements in the list

endIndex

number

A valid index must be >= 1 (and >= startIndex) and  <= count(textList) which is the maximum number of elements in the list.

Output

This function returns a text list


Issue list

Variant for issue lists.

Bash
sublist(issueList, startIndex, endIndex)  #Output: Issue list

Examples

Parser expression

Description

Bash
%{sublist(subtasks(), 1, 3)}

This example returns an issue list with the first 3 sub-tasks.

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

startIndex

NUMBER

A valid index must be >= 1 and <= count(issueList) which is the maximum number of elements in the list.

endIndex

NUMBER

A valid index must be >= 1 (and >= startIndex) and  <= count(issueList) which is the maximum number of elements in the list.

Output

This function returns an issue list


(books) Use cases and examples