You are on the Xporter Cloud documentation. If you are looking for Xporter Server documentation, you can find it in this page.

In this exercise, you'll learn how to populate the Issue Links on 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, at the beginning of the iteration section of your template, put the mapping #{for links}. At the end of that section on your document, put the mapping #{end} to close it.

Since you're iterating, put Links[n]. 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, start your iteration with the statement #{for b=LinksCount} and make sure to change it properly on the Links[b]. at the beginning of the mapping of the Link Field you're trying to populate. 

#{for links}
   ${Links[n].AppType}
   ${Links[n].LinkType}
   ${Links[n].Key}
   ${Links[n].Summary}
   ${Links[n].URL}
#{end}
 
or
 
#{for <VariableName>=LinksCount}
   ${Links[VariableName].AppType}
   ${Links[VariableName].LinkType}
   ${Links[VariableName].Key}
   ${Links[VariableName].Summary}
   ${Links[VariableName].URL}
#{end}

You can use a Conditional Block #{if...} to decide whether to iterate or not.

To use conditional blocks, iterations or mappings, you can use the JavaScript language inside them.

The notation to use the JavaScript on your mappings is:

%{<Javascript>}

You can check examples here.

If the issue doesn't have Links, you can set a message to be displayed instead.

#{if (%{'${LinksCount}' == 0})}
Doesn't have links.
#{end}

If the issue has Links, you can set the message to display the number of Links, along with the Links Iteration.

#{if (%{'${LinksCount}' > 0})}
There are ${LinksCount} links.
#{for links}
AppType: ${Links[n].AppType}
LinkType: ${Links[n].LinkType}
Key: ${Links[n].Key}
Summary: ${Links[n].Summary}
URL: @{title=${Links[n].URL}|href=${Links[n].URL}}
#{end}
#{end}

Xporter for Jira also allows generating hyperlinks on the fly.

We have created a hyperlink on the mapping URL on the code above.

For more details about hyperlinks, check here.

When creating an Excel template document, use: ${link:title=${Key},href=${BaseURL}/browse/${Key}

If you want to display your Links Iteration as a Table, put the Conditional Block above the Header:

#{if (%{'${LinksCount}' == 0})}
No have links.
#{end}
#{if (%{'${LinksCount}' > 0})}
There are ${LinksCount} links.

Then, the Links table Header:

KeySummaryURL

Below it, put the #{for links} or #{for <VariableName>=LinksCount} statement, so the Header is printed only once.

Then, 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}.

#{end}
#{end}

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. For more details, check here.

Below is a sample of how the mappings will be displayed in a Word template:

Below is a sample of how the generated file will be populated:

or

If you like this exercise, please leave a comment or a (thumbs up). Your feedback is very important to us.

Thank you in advance.

Enjoy our product. (big grin)

Here are the files related to this Exercise:

FileDescription
Exercise 2 - Template

Exercise 2 - Sample Template file

Exercise 2 - Generated (versão 1)Exercise 2 - Sample generated file
Exercise 2 - Generated (versão 2) Exercise 2 - Sample generated file without links
  • No labels