On the second In this exercise, you'll learn how to populate the Issue Links on a an Xporter-generated file. The mappings in use are documented here.
The section between #{for links} and #{end} will grow dynamically according to the number of existing Links on the Issue. In order to begin iterating the Issue Links, on at the beginning of the iteration section of your template you must , put the mapping #{for links}, and on . At the end of that section on your document you must , put the mapping #{end} to close it.
You must take into account that since Since you're iterating, you've to put Links[n]. on at the beginning of the mapping of the Link Field you're trying to populate.
When using the #{for links} statement, the variable name will always be n, . If you want to use a different variable name, like b, you must start your iteration instead with the statement #{for b=LinksCount} and must make sure to change it properly on the Links[b]. on at the beginning of the mapping of the Link Field you're trying to populate.
...
You can use a Conditional Block #{if...} to know decide whether to iterate or not.
Info |
---|
In order to do To use conditional blocks, iterations or mappings, you can use the javascript JavaScript language inside them. The notation to use the javascript JavaScript on your mappings is: %{<Javascript>} You can check examples here. |
If the issue doesn't have Links, you can set the a message to be displayed instead.
Code Block | ||||
---|---|---|---|---|
| ||||
#{if (%{'${LinksCount}' == 0})} Doesn't have links. #{end} |
If the issue does have has Links, you can set the message to display the number of Links, along with the Links Iteration.
...
Info |
---|
Xporter for Jira also allows generating hyperlinks on the fly. We have created a hyperlink on the mapping URL on the code above. You can check For more details of about hyperlinks, check here. |
Note |
---|
When creating an Excel template document you should , use: ${link:title=${Key},href=${BaseURL}/browse/${Key} |
If you want to display your Links Iteration as a Table, you must first put the Conditional Block above the Header:
Code Block | ||||
---|---|---|---|---|
| ||||
#{if (%{'${LinksCount}' == 0})} No have links. #{end} #{if (%{'${LinksCount}' > 0})} There are ${LinksCount} links. |
Then, the Links table Header:
Key | Summary | URL |
---|
And below Below it you , put the #{for links} or #{for <VariableName>=LinksCount} statement, so the Header is printed only one timeonce.
With that doneThen, you create another table where the Issue Links will be populated:
${Links[n].Key} | ${Links[n].Summary} | @{title=${Links[n].URL}|href=${Links[n].URL}} |
Finally, close the Links statement using the mapping #{end} and the Conditional Block statement with another #{end}.
...
Info |
---|
There are more fields inside the iteration links that you can populate. You can check which fields are available in the iteration here. You can do this on other types of Iterations. You can check the iterations For more details, check here. |
Below there is a sample of how the mappings will be displayed in a Word template:
Below there Below is a sample of how the generated file will be populated:
...
Info |
---|
If you like this exercise, please share your opinion on the page by just leaving leave a comment or a . Your opinion feedback is very important to us. Thank you in advance. Enjoy our product. |
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Here are the Exercise 2 related filesthe files related to this Exercise:
|