Separate out comma-separated values in usermacro parameter input

Steve Goldberg
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.
July 14, 2013

Hi guys,

I have a user macro that has a number of text inputs which users can put issue numbers in that link to an old, out-of-date issue tracking software (before we got JIRA!). Each input is then generated into a link or simply displayed depending on the viewing user's permissions.

However, this very inefficient. Ideally I would like a single text input where users could input issue numbers separated by commas and the macro would generate these links for each value.

Is it possible to build an array and then do a #foreach for each of these values? Does VTL understand that these values are separated? Is there another way?

Thanks

1 answer

1 accepted

3 votes
Answer accepted
Matthew J. Horn
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.
July 15, 2013

Are you trying to do something like this?

## Macro title: Split Test
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Matthew J. Horn
## Date created: 07/15/13
## Installed by: Matthew J. Horn 

## This macro takes a comma separated list and splits them out in a bulleted list
## @param List:title=Name|type=string|required=true|desc=Comma Separated List

#set( $myList = $paramList.split(","))
<ul>
#foreach( $item in $myList )
    <li>$item</li>
#end
</ul>

Steve Goldberg
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.
July 15, 2013

Matthew Horn saves the day again! Cheers.

Matthew J. Horn
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.
July 15, 2013

Happy to help. You giving another lightning talk at the atlassian conference this year?

Steve Goldberg
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.
July 16, 2013

I thought about it but couldn't think of anything I particularly wanted to talk about. So I won't be going. Sadly, I think macros are an under-represented part of Confluence and wish there were some talks about them. Looking at the list I couldn't see any.

Matthew J. Horn
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.
July 30, 2013

I'd love to go, but couldn't get the budget approved this year. Maybe next year... :(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events