How do I print the for loop count value in Xporter template?

Using the examples from XpandIT's Working With Advanced Templates documentation, how do I export just the total number of values resulting from this query and print that into a new line / cell?  It seems like it should be really straight forward, but I'm missing something

#{for i=JQLIssuesCount|clause=project = DEMO}
${JQLIssues[i].Key} - ${JQLIssues[i].Summary} 

Ex: say in this code example, DEMO has 5 issues. so i = [0,1,2,3,4] I assume as an array of values totaling how many were found in the query.  How do I print the total count of values in that array so that my exported cell has a value of "5"?


The following do not work:

#{[i]} shows #{[0]} or #{[1]} or .... as iterates


2 answers

1 accepted

Hi Geoff Wilson,

You just need to use the var: JQLIssuesCount to get the value. In this case: ${JQLIssuesCount}

Thank you.




I honestly do not remember what I was trying to do with this question, but this answer would likely make sense as JQLIssuesCount I guess is aware of what query took place and you can then put ${JQLIssuesCount} anywhere if so ... or only within that iteration? I have no idea haha. Only found this old question of mine by once again trying to tinker with Xporter and having tons of problems.

I have a similar question.

I want to print out the actual counter to produce numered headings "User Story 1...2...3" in my document.

I ve tried something (JQLIssues[stories], stories, stories.toString()...) but can't figure it out.

#{for stories=JQLIssuesCount|clause=issue in
linkedIssuesByDepth('${JQLIssues[epics].Key}', 1, 'fordert an') and issuetype = Story and ... }

User Story ${stories}



Can give me a hint, please?

Thanks in advance


Hi Jorg,

Here is an example:

#{for stories=JQLIssuesCount|clause=project = DEMO}
   (Issue ${stories} of ${JQLIssuesCount})



thx Rui,

so ${stories} was always right. With your examle in my template it looks like ... (Issue  of 10).

I am using XPorter Version 4.3.10-j6, since last week wink



The example above is for Xporter 5.

For version 4, it's a little bit more tricky, but it works

#{for stories=JQLIssuesCount|clause=project = DEMO}
   (Issue %{stories =+'[stories]'.replace(/\D/g,'')+1;stories.toString()}
of ${JQLIssuesCount})

Try it. It must work like a charm. wink




Did it work?



Hi Rui,

Yesss! It works.

Thanks a lot, again.




Rui Rodrigues.

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

129 views 3 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot