...
Problem Description: In a scenario, where you're trying to extract unique values from an array, encountering duplicate values can be a common challenge.
For example, retrieving unique project names from linked issues might result in duplicates due to multiple associations or other factors.Here's a basic example to get unique values from an array:
Code Block |
---|
{% set array = [1, 2, 2, 3, 4, 4, 5] %}
{% set uniqueValues = [] %}
{% for item in array %}
{% if item not in uniqueValues %}
{% set _ = uniqueValues.append(item) %}
{% endif %}
{% endfor %}
{{ uniqueValues }}
|
This script will output [1, 2, 3, 4, 5]
, which contains only the unique values from the original array.
Now, let's integrate this concept into Jira and JMWE. Suppose you want to extract unique linked project keys from issues in a certain initiative. Here's how you can achieve that using JMWE in Jira:
Solution: To address this issue effectively, you can utilize the following approach, ensuring that only distinct values are retained:
...