indexOf()

Number list

This function returns the index / position of a specified element in a number list.


Bash
indexOf(number, numberList) #Output: Number


Examples

Parser expression

Description

Bash
indexOf(1, [5, 2, 1, 4, 1])

This example returns

3

Bash
indexOf(3, [5, 2, 1, 4, 1])

This example returns the 0, since 3 is not in the provided list.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

number

number

Any given number.

numberList

number list

Any given number list.

Output

This function returns a number .

If the number is not part of the number list, the function returns 0.


Text list

Variant for text lists.


Bash
indexOf(text, textList) #Output: Number


Examples

Parser expression

Description

Bash
indexOf("blue", ["red", "blue", "green"])

This example returns

2

Bash
indexOf("orange", ["red", "blue", "green"])

This example returns the 0, since "orange" is not part of the list.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

text

text

Any given text.

textList

text list

Any given text list.

Output

The function returns a number .

If the text is not part of the text list, the function returns 0.


Issue list

Variant for issue lists.


Bash
indexOf(issueKey, issueList) #Output: Number


Examples

Parser expression

Description

Bash
indexOf(%{issue.key}, issuesUnderEpic())

This example returns the index of the current issue in relationship to all issues under the current epic.

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

issueKey

text

Any given issue key.

issueList

issue list

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

linkedIssues()

or 

subtasks()

).

Output

This function returns a number .

If the issue key is not in the issue list, the function returns 0.


Variant where you define an issue list instead of an issue key.


Bash
indexOf(issueList1, issueList2) #Output: Number


Examples

Parser expression

Description

Bash
indexOf(linkedIssues(), subtasks())


This example returns the index of the first linked issue which is also a subtask.

To achieve this, the following functions are used:

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

issueList1

issue list

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

The index will always be retrieved from the first element of the list. If the list returns [ISSUE1, ISSUE2], the index of ISSUE1 will be retrieved.

issueList2

issue list

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

linkedIssues()

or 

subtasks()

).

Output

This function returns a number .

If the first issue list is empty or the second list does not contain the issue, the function returns 0.


📚 Use cases and examples