getMatchingValue()

Number list

This function returns the numeric reference value or a given text. If the key is not in the keyList, the function returns null


Bash
getMatchingValue(key, keyList, referenceList) #Output: Number


Examples

Parser expression

Description

Bash
getMatchingValue("Three", ["One", "Two", "Three", "Four", "Five"], [1, 1+1, 3*1, 4, 4+1])


This example returns:

3

Bash
getMatchingValue("Critical", ["Normal", "High", "Critical"], [1, 5, 20])


This example returns:

20

Bash
%{getMatchingValue("None", ["Normal", "High", "Critical"], [1, 5, 20, 0])}


This example returns 

0

The textKey "None" is not available in the textList, so the last value of the referenceNumberList is returned (it has one more value than the textList).

Bash
getMatchingValue(%{issue.priority}, ["High", "Medium", "Low"], [3, 2, 1])


This example returns the correct number depending on the current priority.

This example could be used e.g. in the Update or copy field values post function to set a specific field depending on the current priority.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

key

text

A text that exists in the keyList.

keyList

text list

Any given text list.

referenceList

number list

Any given number list.

Output

This function returns a number


Variant with a key and two number lists.


Bash
getMatchingValue(key, keyList, referenceList) #Output: Number


Examples

Parser expression

Description

Bash
getMatchingValue(5, [1, 3, 5, 7, 9], [1, 1+1, 3*1, 4, 4+1])

This example returns:

3

Bash
%{getMatchingValue(3, [1, 5, 7, 9], [1, 2, 3, 4, 99])}


This example returns:

99

The numberKey 3 is not available in the numberList, so the last value of the referenceNumberList is returned (it has one more value than the numberList).

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

key

number

A number that exists in the keyList.

keyList

number list

Any given number list.

referenceList

number list

Any given number list.

Output

This function returns a number


Text list

This function returns the text reference value or a given text.


Bash
getMatchingValue(key, keyList, referenceList) #Output: Text 


Examples

Parser expression

Description

Bash
getMatchingValue("Spain", ["USA", "UK", "France", "Spain", "Germany"], ["Washington", "London", "Paris", "Madrid", "Berlin"])

This example returns:

"Madrid"

Bash
getMatchingValue(%{issue.issueType}, ["Task", "Sub-Task", "Story"], ["This is the description for a Task.", "Description for a Sub-Task", "Here comes the Story."])


This example returns the correct description depending on the current issue type.

This could be used e.g. in the Create issue or Update or copy field values post function to set the description depending on the selected issue type.

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

key

text

A text that exists in the keyList

keyList

text list

Any given text list

referenceList

text list

Any given text list

Output

This function returns a text


Variant with a number list.


Bash
getMatchingValue(key, keyList, referenceList) #Output: Text


Examples

Parser expression

Description

Bash
getMatchingValue(8, [2, 4, 6, 8, 10], ["Washington", "London", "Paris", "Madrid", "Berlin"])

This example returns:

"Madrid"

Additional information

Parameters used in this function

Parameter

Input (data type)

Description

key

number

A number that exists in the keyList

keyList

number list

Any given number list

referenceList

text list

Any given text list

Output

This function returns a text


📚 Use cases and examples