---
title: "Iterations"
canonical: "https://docs.getxporter.app/space/XPORTER/1413887/Iterations"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

## Iterating Issue History

Changes to Jira Issues are registered in the Issue History, but it is not known in advance how many changes are going to be made. You can iterate a section over all the history entries of an Issue.

This allows you to create a table that dynamically grows according to the number of changes done. The notation is:

| **Field** | **Description** |
| --- | --- |
| HistoryEntriesCount | Returns the number of changes made |
| Author | Returns the user who made the change |
| Created | Date of the change |
| ChangedItemsCout | Returns the number of fields changed in the current change |
| ChangedItem | - Field: returns the name of the field in which the value was changed.
- From: returns the old value.
- To: returns the new value. |

### Examples

#### Sample Code

```
#{for historyEntries}
   ${fullname:HistoryEntries[n].Author} made changes ${dateformat("dd-MM-yyyy HH:mm:ss"):HistoryEntries[n].Created}
  #{for ch=HistoryEntries[n].ChangedItemsCount}
	Field Name: ${HistoryEntries[n].ChangedItems[ch].Field}
	Old Value:  ${HistoryEntries[n].ChangedItems[ch].From}
	New Value:  ${HistoryEntries[n].ChangedItems[ch].To}
  #{end} 
#{end}
```

or

```
#{for <VariableName>=HistoryEntriesCount}
   Content and Issue History Mappings. Example:${fullname:HistoryEntries[VariableName].Field} 
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_History.docx?version=1&modificationDate=1624377774970&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_History.xlsx?version=1&modificationDate=1624377787171&cacheVersion=1&api=v2) that iterates over the Issue's changelogs.

---

## Iterating Issue Activity

Changes to Issues are registered in the Issue Activity, but it is not known in advance how many changes are going to be made. You can iterate a section over all the activities of an issue.

This allows you to create a table that dynamically grows according to the number of existing activities. The notation is:

| **Field** | **Description** |
| --- | --- |
| Title | The title of the Issue |
| Summary | The summary of the activity |
| Content | When an activity involves a change in the Issue contents, this field displays the new contents |
| Author | The author of the activity |
| AuthorEmail | The email of the author of the activity |
| Published | The time the issue was published |
| Updated | The time the issue was updated |
| Categories | When an activity regards an Issue Status change, this field displays the new Issue Status |

### Examples

#### Sample Code

```
#{for activityEntries}
   ${ActivityEntries[n].Title}
   ${ActivityEntries[n].Summary}
   ${ActivityEntries[n].Content}
   ${ActivityEntries[n].Author}
   ${ActivityEntries[n].AuthorEmail}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):ActivityEntries[n].Published}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):ActivityEntries[n].Updated}
   ${ActivityEntries[n].Categories}
#{end}
```

or

```
#{for <VariableName>=ActivityEntriesCount}
   Content and Issue Mappings. Example: ${ActivityEntries[VariableName].Field}
#{end}
```

> ℹ️ Use the **HTML function** to render the data because almost all content is HTML, e.g.: `${html:ActivityEntries[n].Title}`

#### Templates

These documents demonstrate examples both in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Activity.docx?version=1&modificationDate=1624378025881&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Activity.xlsx?version=1&modificationDate=1624378026012&cacheVersion=1&api=v2) that iterate over the activity from the Issues.

---

## Iterating Issue Links

Because it is not known in advance how many linked issues exist for an Issue, you can iterate a section over all the linked issues of an Issue.

This allows you to create a table that dynamically grows according to the number of existing linked issues. The notation is:

| **Field** | **Description** |
| --- | --- |
| AppType | The application type of the link:<br>- JIRA: link from the same JIRA Instance.
- External JIRA: link from the another JIRA Instance.
- Confluence: link from a Confluence page.
- External: external link. |
| LinkType | The type of the link |
| Key | The key of the linked Issue |
| Summary | The summary of the linked Issue |
| URL | The URL of the link |

### Examples

#### Sample Code

```
#{for links}
   ${Links[n].AppType}
   ${Links[n].LinkType}
   ${Links[n].Key}
   ${Links[n].Summary}
   ${Links[n].URL}
#{end}
```

or

```
#{for <VariableName>=LinksCount}
   Content and Linked Issue Mappings. Example: ${Links[VariableName].Field}
#{end}
```

> ℹ️ When the link you are iterating is of *AppTypes External Jira* or *Confluence*, the name is obtained using the *Summary* property.

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Links.docx?version=1&modificationDate=1624378213120&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Links.xlsx?version=1&modificationDate=1624378213288&cacheVersion=1&api=v2) that iterate over linked Issues.

---

## Iterating Issue Comments

Because it is not known in advance how many comments exist for an Issue, you can iterate a section over all the comments on an Issue. This allows you to create a table that dynamically grows according to the number of existing comments. The notation is:

| **Field** | **Description** |
| --- | --- |
| Author | The author of the comment |
| AuthorFullName | The full name of the author of the comment |
| Body | The comment |
| Created | The date the comment was posted |
| GroupLevel | The group level of the comment |

### Examples

#### Sample Code

```
#{for comments}
   ${Comments[n].Author} 
   ${Comments[n].AuthorFullName} 
   ${Comments[n].Body} 
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Comments[n].Created}
   ${Comments[n].GroupLevel}
#{end}
```

or

```
#{for <VariableName>=CommentsCount}
   Content and Issue Mappings. Example: ${Comments[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Comments.docx?version=1&modificationDate=1624378268913&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Comments.xlsx?version=1&modificationDate=1624378269094&cacheVersion=1&api=v2) that iterates over the Issue comments.

---

## Iterating Issue Worklogs

Because it is not known in advance how many worklogs exist for an Issue, you can iterate a section over all the worklogs of an Issue.

This allows you to create a table that dynamically grows according to the number of existing worklogs. The notation is:

| **Field** | **Description** |
| --- | --- |
| Author | The author of the worklog |
| AuthorFullName | The full name of the author of the worklog |
| Comment | The comment of the worklog |
| Created | The date the worklog was created |
| Date Started | The date the worklog was started |
| Time Spent | The time spent in seconds |
| TimeSpentFormatted | The time spent as displayed on Jira |
| BilledHours | The billed hours in seconds (belongs to the [Tempo Timesheets](https://docs.getxporter.app/space/XPORTER/1412387) plugin) |
| BilledHoursFormatted | The billed hours as displayed on Jira (belongs to the Tempo Timesheets plugin) |

### Examples

#### Sample Code

```
#{for worklogs}
   ${Worklogs[n].Author} 
   ${Worklogs[n].AuthorFullName} 
   ${Worklogs[n].Comment}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].Created}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].Date Started} 
   ${Worklogs[n].Time Spent}
   ${Worklogs[n].TimeSpentFormatted} 
   ${Worklogs[n].BilledHours} 
   ${Worklogs[n].BilledHoursFormatted} 
#{end}
```

or

```
#{for <VariableName>=WorklogsCount}
   Content and Worklog Mappings. Example: ${Worklogs[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Worklogs.docx?version=1&modificationDate=1624378530012&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Worklogs.xlsx?version=1&modificationDate=1624378530131&cacheVersion=1&api=v2) that iterates over the Issue worklogs.

---

## Iterating Issue Subtasks

Because it is not known in advance how many subtasks exist for an Issue, you can iterate a section over all the subtasks of an Issue.

This allows you to create a table that dynamically grows according to the number of existing subtasks. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| Key | The key of the subtasks |
| Summary | The summary of the subtasks |
| AssigneeUserDisplayName | The assignee user of the subtasks |

### Examples

#### Sample Code

```
#{for subtasks}
   ${Subtasks[n].Key}
   ${Subtasks[n].Summary}
   ${Subtasks[n].AssigneeUserDisplayName}
#{end}
```

or

```
#{for <VariableName>=SubtasksCount}
   Content and Issue Mappings. Example: ${Subtasks[VariableName].Field}
#{end}
```

For an example of how to iterate the details of a subtask parent Issue, please check the [Iterating JQL Queries](http://confluence.xpand-addons.com/display/XPORTER/Iterations#Iterations-IteratingJQLQueries).

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Subtasks.docx?version=1&modificationDate=1624378634467&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Subtasks.xlsx?version=1&modificationDate=1624378634583&cacheVersion=1&api=v2) that iterates over the Issue subtasks.

---

## Iterating Issue Components

Because it is not known in advance how many components exist for an Issue, you can iterate a section over all the components of an Issue.

This allows you to create a table that dynamically grows according to the number of existing components. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| Name | The name of the component |
| Description | The description of the component |
| Lead | The name of the component lead |
| ID | The ID of the component |
| ProjectId | The project ID of the component |
| AssigneeType | The assignee type of the component |

### Examples

#### Sample Code

```
#{for components}
   ${Components[n].Name}
   ${Components[n].Description}
   ${fullname:Components[n].Lead}
   ${Components[n].Id}
   ${Components[n].ProjectId}
   ${Components[n].AssigneeType}
#{end}
```

or

```
#{for <VariableName>=ComponentsCount}
   Content and Issue Mappings. Example: ${Components[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Components.docx?version=1&modificationDate=1624378680412&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Components.xlsx?version=1&modificationDate=1624378680628&cacheVersion=1&api=v2) that iterate over the Issue components.

---

## Iterating Issue Status Transitions

Because it is not known in advance how many Status Transitions exist for an Issue, you can iterate a section over all the Status Transitions of an Issue.

This allows you to create a table that dynamically grows according to the number of existing status transitions. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| Author | The author of the status transition |
| Created | The date the status transition was performed |
| OldStatus | The old status of the status transition |
| NewStatus | The new status of the  status transition |

### Examples

#### Sample Code

```
#{for statusTransitions}
   ${StatusTransitions[n].Author}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):StatusTransitions[n].Created}
   ${StatusTransitions[n].OldStatus}
   ${StatusTransitions[n].NewStatus}
#{end}
```

or

```
#{for <VariableName>=StatusTransitionsCount}
   Content and StatusTransitions Mappings. Example: ${StatusTransitions[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_StatusTransitions.docx?version=1&modificationDate=1624378735938&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_StatusTransitions.xlsx?version=1&modificationDate=1624378736195&cacheVersion=1&api=v2) that iterate over the Issue status transitions.

---

## Iterating Issue Attached Images

Because it is not known in advance how many Images can exist for an Issue (as an attachment), you can iterate a section over all the attached images of an Issue to get some metadata about them.

This allows you to create a table that dynamically grows according to the number of existing images. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| ID | The ID of the attached image |
| Image | The image of the attached image |
| Name | The name of the attached image |
| Size | The size of the attached image |
| HumanReadableSize | The size of the attached image |
| Author | The author of the attached image |
| Created | The date the attached image was created |
| MimeType | The type of the attached image |
| ThumbnailURL | The URL to the thumbnail of the image |

### Examples

#### Sample Code

```
#{for images}
   ${Images[n].Image|maxwidth=150|maxheight=150}
   ${Images[n].Name}
   ${Images[n].ID}
   ${Images[n].Size}
   ${Images[n].HumanReadableSize}
   ${Images[n].Author}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Images[n].Created}
   ${Images[n].MimeType}
   ${Images[n].ThumbnailURL}
 #{end}
```

or

```
#{for <VariableName>=ImagesCount}
   Content and Images Mappings. Example: ${Images[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_AttachedImages.docx?version=1&modificationDate=1624378903804&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_AttachedImages.xlsx?version=1&modificationDate=1624378904039&cacheVersion=1&api=v2) that iterate over the attached images for each Issue.

> ℹ️ [Xporter](https://marketplace.atlassian.com/apps/891368/xporter-export-issues-from-jira?tab=installation&hosting=datacenter) will automatically read the EXIF orientation property of an image and rotate it to its correct orientation. You can turn this off by adding [this property](https://confluence.getxray.app/display/XPORTER/Props#Props-ProcessEXIFproperty) to your Template.

<span style="color: #000000">Since Xporter 5.5.0, you can use the width and height of the mapping to define the exact width and height of the printed image.</span>

```
#{for images}
   ${Images[n].Image|width=150|height=150}
 #{end}
```

<span style="color: #000000">These values are in pixels and if you only define one of them the image will be rescaled.</span>

> ℹ️ - Note that, if you use both maxWidth and width mappings, only the max value will be read. The same behavior happens with height and maxHeight.
> ℹ️ - You can iterate over `${Images[n].Image}` in Excel on Xporter version 5.4.0 and above.

---

## Iterating Issue Attachments

Because it is not known in advance how many attachments exist in an Issue, you can iterate a section over all the attachments of an Issue. 

This allows you to create a table that dynamically grows according to the number of existing attachments. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| ID | The ID of the attachment |
| Name | The name of the attachment |
| Author | The author of the attachment |
| AuthorFullName | The full name of the author of the attachment |
| Created | The date the attachment was created |
| Size | The size of the attachment |
| HumanReadableSize | The formatted size of the attachment |
| MimeType | The type of the attachment |

### Examples

#### Sample Code

```
#{for attachments}
   ${Attachments[n].ID}
   ${Attachments[n].Name}
   ${Attachments[n].Author}
   ${Attachments[n].AuthorFullName}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Attachments[n].Created}
   ${Attachments[n].Size}
   ${Attachments[n].HumanReadableSize}
   ${Attachments[n].MimeType}
#{end}
```

or

```
#{for <VariableName>=AttachmentsCount}
   Content and Issue Mappings. Example: ${Attachments[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Attachments.docx?version=1&modificationDate=1624379037687&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Attachments.xlsx?version=1&modificationDate=1624379037921&cacheVersion=1&api=v2) that iterate over the issue's attachments.

---

## Iterating Issue Labels

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| Name | The name of the label |

### Examples

#### Sample Code

```
#{for labels}
   ${Labels[n].Name}
#{end}
```

or

```
#{for <VariableName>=LabelsCount}
  ${Labels[VariableName].Name}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Labels.docx?version=1&modificationDate=1624379086392&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Labels.xlsx?version=1&modificationDate=1624379086509&cacheVersion=1&api=v2) that iterate over the Issue's labels.

---

## Iterating Project Versions from an Issue

You can iterate over all project versions to which the Issue belongs. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| Name | The name of the project version |
| Description | The description of the project version |
| `Start date` | The Start Date of the project version |
| `Release date` | The Release Date of the project version |

### Examples

#### Sample Code

```
#{for projectVersions}
   ${ProjectVersions[n].Name}
   ${ProjectVersions[n].Description}
   ${dateformat("dd-MM-yyyy"):ProjectVersions[n].Start date}
   ${dateformat("dd-MM-yyyy"):ProjectVersions[n].Release date}
#{end}

```

or

```
#{for <VariableName>=ProjectVersionsCount}
   ${ProjectVersions[VariableName].Name}
   ${ProjectVersions[VariableName].Description}
   ${dateformat("dd-MM-yyyy"):ProjectVersions[VariableName].Start date}
   ${dateformat("dd-MM-yyyy"):ProjectVersions[VariableName].Release date}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_ProjectVersions.docx?version=1&modificationDate=1624379132207&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_ProjectVersions.xlsx?version=1&modificationDate=1624379132448&cacheVersion=1&api=v2) that iterate over the Issue's project versions.

---

## Iterating Issue Commits

Because it is not known in advance how many commits exist for an Issue, you can iterate a section over all the commits of an Issue.

This allows you to create a table that dynamically grows according to the number of existing commits. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| URL | The URL of the link |
| CreatedDateTime | The date the commit was created |
| `Message` | The message of the commit |
| `Author` | The author of the commit |

  
In order to extract more information from Commits, it is possible to get information from the files that were committed:  

| <span style="color: #000000">**Commits files count Fields**</span> | **Description** |
| --- | --- |
| FilesCount.Path | The path of the file was committed |
| FilesCount.URL | The URL of the file was committed |
| FilesCount.ChangeType | Identify the type of change that occurred in the commit |

### Examples

#### Sample Code

```
#{for commits}
	${Commits[n].Author} 
	${Commits[n].URL} 
	${Commits[n].Message}
	${Commits[n].CreatedDateTime}
	
	Here we have the FilesCount where we can get all the files associated with a commit.
	#{for m=Commits[n].FilesCount}
		${Commit[n].FilesCount[m].Path}
		${Commit[n].FilesCount[m].URL}
		${Commit[n].FilesCount[m].ChangeType}
	#{end}
#{end}
```

or

```
#{for <VariableName>=CommitsCount}
   Content and Issue Mappings. Example: ${Commits[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Commits.docx?version=1&modificationDate=1624379274226&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Commits.xlsx?version=1&modificationDate=1624379274345&cacheVersion=1&api=v2) that iterate over the issue's commits.

---

## Iterating Issue Branches

Because it is not known in advance how many branches exist for an Issue, you can iterate a section over all the branches of an Issue.

This allows you to create a table that dynamically grows according to the number of existing branches. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| URL | The URL of the Branch |
| Name | The name of the Branch |
| RepositoryName | The name of the repository |
| RepositoryURL | The URL of the repository |

### Examples

#### Sample Code

```
#{for branches}
  ${Branches[n].URL}
  ${Branches[n].Name}
  ${Branches[n].RepositoryName}
  ${Branches[n].RepositoryURL}
#{end}
```

 or

```
#{for <VariableName>=BranchesCount}
   Content and Issue Mappings. Example: ${Branches[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Branches.docx?version=1&modificationDate=1624379318669&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Branches.xlsx?version=1&modificationDate=1624379319326&cacheVersion=1&api=v2) that iterate over the Issue's branches.

---

## Iterating Issue Pull Requests

As it is not known in advance how many pull requests exist for an Issue, you can iterate a section over all the pull requests of an Issue.

This allows you to create a table that dynamically grows according to the number of existing pull requests. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| URL | The URL of the Branch |
| Name | The name of the Branch |
| RepositoryName | The name of the repository |
| RepositoryURL | The URL of the repository |
| CommentsCount | Counts the number of comments in the pull request |
| Status | The status of the pull request |
| LastUpdated | The last time the pull request was updated |
| PullRequestReviewers.Name | The name of the pull request reviewer |
| PullRequestReviewers.Approved | Indicates the approval of the pull request reviewer |

You can get information about reviewers from each  pull request:

| <span style="color: #000000">**Pull Request reviewers Fields**</span> | **Description** |
| --- | --- |
| PullRequestReviewers.Name | The name of the pull request reviewer |
| PullRequestReviewers.Approved | Indicates the approval of the pull request reviewer |

### Examples

```
#{for pullRequests}
  	${PullRequests[n].URL}
  	${PullRequests[n].Name}
  	${PullRequests[n].RepositoryName}
  	${PullRequests[n].RepositoryURL}
	${PullRequests[n].CommentsCount} (This represents the number of comments in a pull request)
	${PullRequests[n].Status}
	${PullRequests[n].LastUpdated}
 
	Here we have the PullRequestReviews where we can get all the reviewers for this pull request.
	#{for m=PullRequests[n].PullRequestReviewers}
  		${PullRequests[n].PullRequestReviewers[m].Name}
  		${PullRequests[n].PullRequestReviewers[m].Approved}
	#{end}
#{end}
```

or

```
#{for <VariableName>=PullRequestsCount}
   Content and Issue Mappings. Example: ${PullRequests[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_PullRequests.docx?version=1&modificationDate=1624379365330&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_PullRequests.xlsx?version=1&modificationDate=1624379365588&cacheVersion=1&api=v2) that iterate over the issue's pull requests.

---

## Iterating Issue Builds

Because it is not known in advance how many builds exist for an Issue, you can iterate a section over all the builds of an Issue.

This allows you to create a table that dynamically grows according to the number of existing builds. The notation is:

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| ProjectName | The build project name |
| ProjectKey | The build project key |

  
To get more information, you can get all the individual plans for the project and the corresponding build.

| <span style="color: #000000">**Build plans Fields**</span> | **Description** |
| --- | --- |
| Plans.Key | The plans build key |
| Plans.Name | Theplansbuild name |
| Plans.BuildNumber | The plans build number |
| Plans.BuildKey | The plans build key |
| Plans.BuildDuration | The duration of the build |
| Plans.BuildFinishedDate | The date when plans build was finished |

### Examples

#### Code Sample

```
#{for builds}
  	${Builds[n].ProjectName}
  	${Builds[n].ProjectKey}
	
	Here we have the each Build Plans where we can get all the individual plans for this project and the correspondent build in existence for this plan.
	#{for m=Builds[n].Plans}
  		${Builds[n].Plans[m].Key}
  		${Builds[n].Plans[m].Name}
  		${Builds[n].Plans[m].BuildNumber}
  		${Builds[n].Plans[m].BuildKey}
  		${Builds[n].Plans[m].BuildDuration}
  		${Builds[n].Plans[m].BuildFinishedDate}
	#{end}
#{end}
```

 or

```
#{for <VariableName>=BuildsCount}
   Content and Issue Mappings. Example: ${Builds[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Builds.docx?version=1&modificationDate=1624380036047&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Builds.xlsx?version=1&modificationDate=1624380036316&cacheVersion=1&api=v2) that iterate over the issue's builds.

---

## Iterating Issue Reviews

Because it is not known in advance how many reviews exist for an Issue, you can iterate a section over all the pull requests of an Issue.

This allows you to create a table that dynamically grows according to the number of existing reviews. The notation is:<span style="color: #000000"> </span>

| <span style="color: #000000">**Field**</span> | **Description** |
| --- | --- |
| ID | The review ID, e.g., 1 |
| URL | The URL of the review |
| Status | The review status |
| Title | The title of the review |
| Author | The author of the review |
| Moderator | The moderator of the review |

  
To get all the reviewers from this review, you can use the following mappings:

| <span style="color: #000000">**Reviewers Fields**</span> | **Description** |
| --- | --- |
| Reviewers.Username | The username of each reviewer |
| Reviewers.Completed | The completed name of each reviewer |

### Examples

#### Sample Code

```
#{for reviews}
  	${Reviews[n].Id}
  	${Reviews[n].URL}
  	${Reviews[n].Status}
  	${Reviews[n].Title}
  	${Reviews[n].Author}
  	${Reviews[n].Moderator}
	
	Here we have the Reviewers for each review where we can get all the individual reviewers for this review.
	#{for m=Reviews[n].Reviewers}
 		${Reviews[n].Reviewers[m].Username}
  		${Reviews[n].Reviewers[m].Completed}
	#{end}
#{end}
```

or

```
#{for <VariableName>=ReviewsCount}
   Content and Issue Mappings. Example: ${Reviews[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Reviews.docx?version=1&modificationDate=1624380082527&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Reviews.xlsx?version=1&modificationDate=1624380082810&cacheVersion=1&api=v2) that iterates over the Issue's reviews.

---

## Iterating Parent Issues

You can iterate a section over all the parent issues of an Issue. This allows you to create a table that dynamically grows according to the information you want to see from parent Issues.

Imagine that you have a Jira Issue that contains a Key, Summary, Description, and further information. From now on, you can get all the information from a parent Issue.

To get those fields, you just need to have the following definition: `${Parent.<Field>}`

### Examples

#### Sample Code

This example only has a few fields, but this new feature allows you to get all the information from a parent Issue.

```
&{for issues|filter=%{'${IssueTypeName}'.equals('Sub-task')}}
   ${Parent.Key}
   ${Parent.Summary}
   ${Parent.Description}
   ${wiki:Parent.Description}
   ${html:Parent.Description}
   ${dateformat(“dd-MM-yyyy HH:mm:ss”):Parent.date}
   ${emailaddress:Parent.userpicker}
&{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Parents.docx?version=1&modificationDate=1624380134291&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_Issue_Parents.xlsx?version=1&modificationDate=1624380134822&cacheVersion=1&api=v2) that iterates over the parent Issues.

---

## Iterating Issues In Epic

<span style="color: #000000">All fields listed </span>[<span style="color: #000000">here</span>](https://docs.getxporter.app/space/XPORTER/1413922/Mappings)<span style="color: #000000"> </span><span style="color: #000000">are available on </span>`IssuesInEpic[n]`<span style="color: #000000"> because they represent an Issue.</span>

Because it is not known in advance how many Issues exist for an epic, you can iterate a section over all the issues of an epic issue.

This allows you to create a table that dynamically grows according to the number of existing Issues. The notation is:

### Examples

#### Sample Code

```
#{for IssuesInEpic}
   ${IssuesInEpic[n].Key}
   ${IssuesInEpic[n].Summary}
   ${IssuesInEpic[n].Description}
   ${IssuesInEpic[n].Epic Link.Key}
#{end}
```

or

```
#{for <VariableName>=IssuesInEpicCount}
   Content and Issue Mappings. Example: ${IssuesInEpic[VariableName].Field}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_IssuesInEpic.docx?version=1&modificationDate=1624380169446&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_IssuesInEpic.xlsx?version=1&modificationDate=1624380169569&cacheVersion=1&api=v2) that iterate over the Issues in epic.

---

## Iterating JQL Queries

You can iterate Issues that are the result of a [JQL Query](https://docs.getxporter.app/space/XPORTER/1413910/JQL). The syntax is similar to the other iterations, but there is a **clause** parameter that will receive the JQL Query.

### Examples

#### Sample Code

A simple example iterating the details of issues from a specified project:

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

```

Or a more advanced example iterating the details of Issues linked with the current Issue:

```
#{for m=JQLIssuesCount|clause=issuekey in linkedIssues (${Links[j].Key})}
   Linked Issue ${JQLIssues[m].Summary} has ${JQLIssues[m].LinksCount} links
#{end}
```

Or an also advanced example iterating the details of the parent Issue from the current Ssubtask:

```
#{for i=JQLIssuesCount|clause=issuekey = ${ParentIssueKey}}
	${JQLIssues[i].Key}
	${JQLIssues[i].Id}
	${JQLIssues[i].Description}
#{end}
```

#### Templates

These documents demonstrate examples in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_JQLQueries.docx?version=1&modificationDate=1624379185694&cacheVersion=1&api=v2) and [Excel templates](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Iterating_JQLQueries.xlsx?version=1&modificationDate=1624379185989&cacheVersion=1&api=v2) with JQL examples.

> ℹ️ You can also [use a Filter Name or a Filter ID as a clause](https://docs.getxporter.app/space/XPORTER/1413910/JQL).

---

## Applying Filters to Iterations

If you want to take the previous iterations over comments, subtasks, and issue links to another level of control, you can use a JavaScript filter to define over which issues the iteration will be made.

This can be useful in the following scenarios:

- Iterating over linked Issues that are only of a specific Issue type.
- Iterating over subtasks of a specific Issue type.
- Iterating over linked Issues with a specific priority.
- Iterating over comments created by a specific user.

The notation for applying filters to the iterations is:

```
#{for <VariableName>=<LinksCount|SubtasksCount|CommentsCount|WorklogsCount>|filter=%{<Javascript>}}
   Content here
#{end}
```

- <u> </u>**<u>VariableName</u>** is the name of the variable to use as the iteration index.
- <u> </u>**<u>LinksCount|SubtasksCount|CommentsCount </u>**indicates over which type of entities you want to iterate.
- **<u>Filter</u>** indicates the filter to be applied in the iteration.

Filter is evaluated as a JavaScript expression, which provides flexibility in the definition of the conditions. You can use `(&&)`, or `(||)` and other logical operators supported by the JavaScript language.

It is also possible to [format fields inside iteration filters](https://docs.getxporter.app/space/XPORTER/1413887/Iterations).

<span style="color: #172B4D">This document demonstrates an </span>[<span style="color: #172B4D">example of a Template</span>](https://docsxporter.atlassian.net/wiki/download/attachments/1413887/Links_with_Filter.docx?version=1&modificationDate=1624380235307&cacheVersion=1&api=v2)<span style="color: #172B4D"> that iterates over issue links and comments with filters being applied.</span>

---

## Iterating in the Same Line of the Document

You can also iterate values in the same line of the document. This can be useful if you want to display a list of subtasks on linked Issues in the same line, separated by commas or spaces. 

### Notations

- Users that added comments to this Issue: `#{for comments}${Comments[n].Author} #{end}`
- Subtasks of this Issue: `#{for j=SubtasksCount}${Subtasks[j].Key};#{end}`
- Linked Issues this Issue duplicates: `#{for j=LinksCount|filter=%{'${Links[j].LinkType}'.equals('duplicates')}}${Links[j].Key} #{end}` ` `

---

## Iterating in the Same Cell in an Excel Document

You can iterate values in the same cell in an Excel document. You can achieve this by simply making your Iteration inside the same cell.

You can use all the iterations that you are used to and construct them in the same way, the difference being that you only use one cell to do them.

### Notation

Issue iteration as a demonstration. Copy this iteration below and paste it into a cell: `&{for issues} ${Key} &{end}`

---

## Iterating with the BREAK or CONTINUE Statement

You can iterate anything, set up a Conditional expression, and then utilize the BREAK and CONTINUE statements.

The way to do this is by doing a normal Conditional expression and using the mapping `#{break}` or `#{continue}` inside it. 

### Example

Imagine that you have a Jira Issue that contains these comments:

- "Hello".
- "World".
- "Greetings".
- "Hi".

#### Break Functionality

For the Break functionality, let's say that you want to stop the iteration if the current comment is "World". Here is the template for that: `#{for comments}`

Current Comment: `${Comments[n].Body} #{if (%{'${Comments[n].Body}'.equals('World')})} #{break} #{end}`

Current Comment Author: `${Comments[n].Author} #{end}`

In this case, Xporter for Jira will print the comment "Hello" and its author. Next, it will print the comment body "World", but since the Conditional expression is true, it will stop the iteration altogether and not print anything else.

> ℹ️ Anything after the `#{break}` mapping will not be printed in the exported document.

#### Continue Functionality

For the Continue functionality, let's say that you want to skip to the next iteration if the current comment is "World", bypassing the Author mapping for this iteration.

Here is the template for that: `#{for comments}`

Current Comment: `${Comments[n].Body} #{if (%{'${Comments[n].Body}'.equals('World')})} #{continue} #{end}`

Current Comment Author: `${Comments[n].Author} #{end}`

In this case, Xporter for Jira will print the comment "Hello" and its author. Next, it will print the comment Body "World" but since the Conditional expression is true, it will continue to the next iteration, not printing the Author of the "World" comment.

---

## Sorting Iterations

Imagine that you have an iteration and want to sort it by any field that it can export normally. This will be the header for such an iteration: `#{for comments|sortby=<Iteration mapping>}`

> ℹ️ The mapping after the "sortby" must be equal to the supported mappings for each iteration.

### Example

This iteration will be sorted by the body of all the comments in the Issue.

```
#{for comments|sortby=Body}
${Comments[n].Author}
${Comments[n].Body}
#{end}
```

#### Sort By Bulk Export

The `sortby` can also be used to sort a `&{for issues}` iteration on a Bulk Export.

```
&{for issues|sortby=IssueTypeName}
${Key} - ${IssueTypeName}
&{end}
```

> ℹ️ **Sorting Criteria**
> ℹ️ 
> ℹ️ `asc` (the default value) and `desc` can be defined to define how you want to sort your data.

<details>
<summary>Support/Troubleshooting</summary>

If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://docs.getxporter.app/space/XPORTER/23102936).
</details>