Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Building a string

Anthony Nguyen June 18, 2024

Is there some way to build a string with branching? I have a JSON and want to grab id from each entry and append them all together, i.e. id1&id2&id3.

I created a variable {{ids}} with {{empty}} and set up advanced branching. With logging, I can see the ids, but my attempts to append to {{ids}} doesn't seem to work. Additionally, accessing {{ids}} outside of the loop reports that it is empty.

2 answers

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 19, 2024

Hey @Hariharan Iyer the bigger problem for @Anthony Nguyen isn't going to be the lack of a concat function, but rather that he wants to build the strings as part of advanced branching.

Automation doesn't support "global" variables, and there's complications with scope of variables inside of branches. Additionally there's some confusing and interesting problems introduced because many rules (including Advanced branching across multiple issues) happen asynchronously and so may stomp on each other.

Basically if you're thinking that everything runs sequentially... it doesn't. It's been a while since I've been down the rabbit hole, but @Bill Sheboy always seems to be able to explain it well.

But anyways @Anthony Nguyen, that's probably why your variables are turning up empty.

I suggest you take a look at these open issues:

0 votes
Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2024

`concat` doesn't work with smart values, but if you're getting the ids as a jsonStringArray, you should be able to do something like this without branching

{{jsonStringArray.replaceAll(",\s+", "&").replace("[","").replace("]","")}}

 

Hope that helps!

 

~ Hariharan 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events