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} 
#{end}

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
#{JQLIssuesCount[i]}
#{i}

 

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.

 

Cheers,

RMRodrigues.

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}

${wiki:JQLIssues[stories].anyContent}
#{end}

 

Can give me a hint, please?

Thanks in advance

Jörg

Hi Jorg,

Here is an example:

#{for stories=JQLIssuesCount|clause=project = DEMO}
   ${JQLIssues[stories].Key}
   (Issue ${stories} of ${JQLIssuesCount})
#{end}

Cheers,

Rui.

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

Jörg

Hi,

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}
   ${JQLIssues[stories].Key}  
   (Issue %{stories =+'[stories]'.replace(/\D/g,'')+1;stories.toString()}
of ${JQLIssuesCount})
#{end}

Try it. It must work like a charm. wink

Cheers,

Rui.

Hi,

Did it work?

Cheers,

Rui.

Hi Rui,

Yesss! It works.

Thanks a lot, again.

Jörg

Great.

Cheers.

Rui Rodrigues.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked 6 hours ago in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

52 views 3 3
View question

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