### Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
cancel
Showing results for
Did you mean:
See all
##### Top groups
Explore all groups

## Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user

Level 1: Seed

25 / 150 points

Next: Root

## Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

What goes around comes around! Share the love by gifting kudos to your peers.

## Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

# Iterate over a list of substrings and find the lowest

Edited

Hi there!

I have a field in my JIRA issues which is basically a set of comma separated numbers (with max 999). Im looking to find a way to iterate through them using the various automation functions and select the lowest of them. I cant seem to grasp how to use the # operator and the list functions to do this.  So effectively I want to do the equivalent of this pseudocode

int lowest = 1000

for (int i =0 i< list.length(); i++) {

if (list.get(i) < lowest {

lowest=list.get(i)

}

}

I'd really appreciate any tips on how to attack this problem

Chris

#### 2 accepted

1 vote
Riley Venable _Atlas Bench_
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2023

You can use the MIN() function in JQL to find the lowest number in a list. For example, if you have a field called "numbers" with a list of comma-separated numbers, you can use the following query to find the lowest number: MIN(numbers) Keep in mind that Jira rounds decimals to the nearest 1000th place, and people can enter large numbers using scientific notation.

1 vote
Gareth Cantrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Feb 17, 2023 • edited

This is can be done quite simply with some of the smart value functions available in Jira automation.

`{{description.split(",").min}}`

I used the description field, so just replace that with your actual field.

Wow. That was easy - thanks for answering Gareth. I feel a bit stupid now :-) Do see a way to extend this to reordering the whole list?

Gareth Cantrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Feb 17, 2023

Unfortunately, there is currently no option to sort lists.

I believe there are some feature requests for this which you could vote for.

You can search through these projects on JAC, depending on which platform you're on: https://jira.atlassian.com/projects?selectedCategory=all&selectedProjectType=all&contains=automation&sortColumn=name&sortOrder=ascending&s=view_projects