It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

control structures in macros

Paula Manildi Dec 12, 2015

This question is in reference to Atlassian Documentation: User Macro Template Syntax

I'm looking for the syntax for control structures like #foreach - what else is available? I want to show all the spaces, similiar to https://answers.atlassian.com/questions/43122/know-space-administrators, but I get a timeout, so I want to exit the foreach at a certain count... unless I can figure out a different way to limit getAllSpaces().

3 answers

0 votes
Alex Yasurek Dec 13, 2015

There are also if statements. What are you trying to do?

0 votes
Stephen Deutsch Dec 15, 2015

You can use the #break command to break out of a #foreach loop.  More information about Velocity itself can be found on this page: http://velocity.apache.org/engine/devel/user-guide.html

I think Confluence uses Velocity 1.6, and they do not have any plugins installed, so no MathTool, SortTool, etc.

0 votes
Paula Manildi Dec 15, 2015

Thanks! I got #break to work (I guess I wasn't doing it correctly the first time I tried). Now I just have to figure out how to partially query spaces, because the foreach over $spaceManager.getAllSpaces() times out after 13 or so.  Using a version of this: https://answers.atlassian.com/questions/43122

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

1,245 views 7 18
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you