Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering smart value lists

27 comments

Bill Sheboy
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.
October 1, 2024

Hi @Josh Marsh 

I recall experimenting with {{index}} within iterators a few years ago, discovering it appears to be a just-in-time attribute of the list iterator and does not exist in a way which permits use in functions, filters, etc.

 

A possible workaround is to expand the list into another variable with each index, and then use inline filtering with match().  Perhaps like this:

  • action: create a new variable, which creates a delimited list of index and value pairs
    • name: varExpandedList
    • smart value: {{issue.Impacted Users.split(",")}}{{index}},{{.}};{{/}}
  • action: some other action to extract the values
    • for example, this would return the first 11 of them, as {{index}} is zero-based
      • {{varExpandedList.split(";").match("^(([0-9]|10),.+)$").substringAfter(",")}}

Please research regular expressions to find one that works for your range of index values.

 

What is the source of your list of "Impacted Users"?  Knowing that may help to suggest other options.

 

Kind regards,
Bill

Josh Marsh October 2, 2024

Hi @Bill Sheboy ,

Thanks so much. Using match() was a great idea.

FYI in the end (with a little help from ChatGPT), these were my successful regular expressions:

  • First 100 values
    {{varExpandedList.match("^((.*?;){99}.*?)(;|$)").split(";")}}

  • Second 100 values
    {{varExpandedList.match("^(?:.*?;){100}((.*?;){99}.*?)(;|$)").split(";")}}

I didn't need to use index at all in the end, since the match() function seems to respect the original order of the list.

And since you asked, the list of Impacted Users comes from a query run in Excel, which is then copy and pasted to the custom field in Jira.

Thanks again,
Josh

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events