Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×Both of these are still printing a comma (, ) at the end of the list. Any idea why??
Yes, and...to the suggestions from @Tuncay Senturk _Snapbytes_ with some adjustments...
For iteration which has filtering, I recommend not worrying about a trailing delimiter such as a comma; the complexity / risk of errors is not worth the trouble.
Instead, always add the delimiter and remove it later with text functions prior to a splitting back into a list. Also, I recommend combining your iterators and conditional filtering. For example:
{{#lookupIssues.issuelinks}}{{#if(and(equals(type.inward, "is cloned by"), inwardIssue.key.startsWith("SCR")))}}{{key}} - {{status.name}},{{/}}{{/}}
{{varFilteredList.substringBeforeLast(",").split(",")}}
Given the number of filters, it may be better to just change the JQL for the lookup action to avoid this complexity.
Finally, please note: once inside of a {{lookupIssues}} iterator, the issue prefix is not used, just the field smart values.
Kind regards,
Bill
{{^last}} is evaluated against the original loop, not your filtered output.
Because you’re skipping items inside the loop with #if(...)
, the item you print last usually isn’t the actual last element of the collection. so {{^last}} is still true and you get a trailing comma.
Fix it by making the loop only contain the items you’ll print, then last will work
I am not sure if this will work but you can try something similar below
{{#issue.issuelinks.whereEquals("type.inward","is cloned by")
.whereStartsWith("issue.key","SCR")}}
{{issue.key}} - {{issue.status.name}}{{^last}}, {{/last}}
{{/issue.issuelinks.whereEquals("type.inward","is cloned by")
.whereStartsWith("issue.key","SCR")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.