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

## Iterating Issue Links

Because the number of linked issues associated with an item is not predetermined, you can iterate over all the linked Issues. This functionality enables you to create a table that dynamically expands based on the number of linked Issues present.

All fields listed [here](https://docs.getxporter.app/space/XPORTERCLOUD/558575/Mappings#Using-Mappings) are accessible via Links[n] since they pertain to an individual issue. Additionally, two new fields are available at the Filter Name or Fi[n] level:

| **Field** | **Description** |
| --- | --- |
| AppType | Returns the Application Type. The values can be:<br>- Jira (link from the same Jira Instance).
- External Jira (link from another Jira instance).
- Confluence (link from a Confluence page).
- External (external link). |
| LinkType | Returns the link type |

### 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}
```


> ℹ️ <span style="color: #000000">When the link you are iterating is of AppTypes </span>**<span style="color: #000000">External Jira </span>**<span style="color: #000000">or</span>**<span style="color: #000000"> </span>****<span style="color: #000000">Confluence</span>****<span style="color: #000000">,</span>**<span style="color: #000000"> the name is obtained using the </span>*<span style="color: #000000">Summary</span>*<span style="color: #000000"> property.</span>

<span style="color: #000000">These</span> <span style="color: #000000">documents demonstrate examples both in </span>[<span style="color: #000000">Word</span>](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Links.docx?version=1&modificationDate=1694008585474&cacheVersion=1&api=v2)<span style="color: #000000"> and </span>[<span style="color: #000000">Excel</span>](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Links.xlsx?version=1&modificationDate=1694008585570&cacheVersion=1&api=v2)<span style="color: #000000"> templates that iterate over linked issues.</span>

---

## Iterating Issue Comments

Because the number of comments associated with an issue is not known beforehand, you can iterate over all the comments on an issue. This feature enables you to create a table that dynamically expands according to the number of existing comments.

The notation is:

| **Comments Fields** | **Description** |
| --- | --- |
| Author | The author of the comment |
| AuthorFullName | The full name of the author of the comment |
| Body | The comment body  [Wiki] |
| Created | The date the comment was posted |
| CreatedDate | The date the comment was posted |
| CreatedDateTime | The date the comment was posted |
| GroupLevel | The group level of the comment |
| Internal | The comment is internal or public |

### Sample Code

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

or

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


<span style="color: #000000">These documents demonstrate examples both in </span>[<span style="color: #000000">Word</span>](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Comments.docx?version=1&modificationDate=1694008585903&cacheVersion=1&api=v2)<span style="color: #000000"> and </span>[<span style="color: #000000">Excel</span>](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Comments.xlsx?version=1&modificationDate=1694008586002&cacheVersion=1&api=v2)<span style="color: #000000"> templates that iterate over all the issue comments.</span>

---

## Iterating Issue Worklogs

Because the number of worklogs associated with an issue is not known in advance, you can iterate over all the worklogs of an Issue. This allows you to create a table that dynamically expands according to the number of existing worklogs.

The notation is:

| **Worklogs Fields** | **Description** |
| --- | --- |
| Author | The author of the worklog |
| AuthorFullName | The full name of the author of the worklog |
| Comment | The comment of the worklog [Wiki] |
| Created | The worklog's creation date. |
| CreatedDate | The worklog's creation date. |
| CreatedDateTime | The worklog's creation date. |
| Date Started | The date the worklog was started |
| StartDate | The date the worklog was started |
| StartDateTime | The date the worklog was started |
| TimeSpent | The time spent in seconds |
| Time Spent | The time spent in seconds |
| TimeSpentFormatted | The time spent as displayed on Jira |
| BillableSeconds | The billable seconds (belongs to the [Timesheets by Tempo](https://marketplace.atlassian.com/apps/6572/timesheets-by-tempo-jira-time-tracking?tab=overview&hosting=cloud) plugin) |

### 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].CreatedDate}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].CreatedDateTime}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].StartDate}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].Date Started}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Worklogs[n].StartDateTime} 
   ${Worklogs[n].Time Spent}
   ${Worklogs[n].TimeSpent}
   ${Worklogs[n].TimeSpentFormatted} 
   ${Worklogs[n].BillableSeconds}
#{end}
```

or

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

<span style="color: #000000">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Worklogs.docx?version=1&modificationDate=1694008586099&cacheVersion=1&api=v2)<span style="color: #000000"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Worklogs.xlsx?version=1&modificationDate=1694008586234&cacheVersion=1&api=v2)<span style="color: #000000"> templates that iterate over the issue worklogs.</span>

---

## Iterating Issue Subtasks

All fields listed [here](https://docs.getxporter.app/space/XPORTERCLOUD/558575/Mappings#Using-Mappings) are available on Subtasks[n] because each one represents an Issue.

Since the number of subtasks associated with an issue is not known in advance, you can iterate over all the subtasks of an issue. This enables you to create a table that dynamically expands based on the number of existing subtasks.

The notation is:

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

### Sample Code

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

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Subtasks.docx?version=1&modificationDate=1694008586334&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Subtasks.xlsx?version=1&modificationDate=1694008586441&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the issue subtasks.</span>

---

## Iterating Issue Components

Because the number of components associated with an issue is not known in advance, you can iterate over all the components of an issue. This enables you to create a table that dynamically expands according to the number of existing components.

The notation is:

| <span style="color: #000000">**Components Fields**</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 |

### 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 Components Mappings. Example: ${Components[VariableName].Field}
#{end}
```

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_Components.docx?version=1&modificationDate=1694008586541&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_Components.xlsx?version=1&modificationDate=1694008586648&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the issue components.</span>

---

## Iterating Issue Status Transitions

Because the number of status transitions associated with an issue is not known in advance, you can iterate over all the status transitions of an issue. This enables you to create a table that dynamically expands according to the number of existing status transitions.

The notation is:

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

### Sample Code

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

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_StatusTransitions.docx?version=1&modificationDate=1694008586744&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_StatusTransitions.xlsx?version=1&modificationDate=1694008586830&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the issue status transitions.</span>

---

## Iterating Issue Attached Images

Because the number of images attached to an issue is not known in advance, you can iterate over all the attached images of an Issue to retrieve metadata about them. This enables you to create a table that dynamically expands according to the number of existing images.

The notation is:

| <span style="color: #000000">**Attachments Images Fields**</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 (ID) of the attached image |
| Created | The date the attached image was created |
| CreatedDate | The date the attached image was created |
| CreatedDateTime | The date the attached image was created |
| MimeType | The type of the attached image |
| ThumbnailURL | The URL to the thumbnail of the image |

### 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}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Images[n].CreatedDate}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Images[n].CreatedDateTime}
   ${Images[n].MimeType}
   ${Images[n].ThumbnailURL}
 #{end}
```

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_AttachedImages.docx?version=1&modificationDate=1694008586958&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_AttachedImages.xlsx?version=1&modificationDate=1694008587065&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the attached images for each issue.</span>

> ℹ️ Xporter 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://docs.getxporter.app/space/XPORTERCLOUD/462130/Props#Process-EXIF-property) to your template.

<span style="color: #000000">You can use the mappings </span>*<span style="color: #000000">width</span>*<span style="color: #000000"> and </span>*<span style="color: #000000">height</span>*<span style="color: #000000"> to define the exact width and height of the printed image.</span>

### <span style="color: #000000">Sample Code</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>

> ℹ️ If you use both *maxWidth* and *width* mappings, only the *max* value will be read. The same behavior happens with *height* and *maxHeight*.

---

## Iterating Issue Attachments

<span style="color: #0d0d0d">Because it is not known in advance how many attachments exist for an issue, you can iterate over all the attachments of an Issue. This allows you to create a table that dynamically grows according to the number of existing attachments. </span>

<span style="color: #0d0d0d">The notation is:</span>

| <span style="color: #000000">**Attachments Fields**</span> | **Description** |
| --- | --- |
| ID | The ID of the attachment |
| 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 |
| CreatedDate | The date the attachment was created |
| CreatedDateTime | 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 |

### 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}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Attachments[n].CreatedDate}
   ${dateformat("dd-MM-yyyy HH:mm:ss"):Attachments[n].CreatedDateTime}
   ${Attachments[n].Size}
   ${Attachments[n].HumanReadableSize}
   ${Attachments[n].MimeType}
#{end}
```

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Attachments.docx?version=1&modificationDate=1694008587184&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Attachments.xlsx?version=1&modificationDate=1694008587285&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the issue's attachments.</span>

---

## Iterating Issue Labels

<span style="color: #0d0d0d">Because it is not known in advance how many labels exist for an Issue, you can iterate over all the labels of an Issue. </span>

<span style="color: #0d0d0d">The notation is:</span>

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

### Sample Code

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

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Labels.docx?version=1&modificationDate=1694008587388&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Labels.xlsx?version=1&modificationDate=1694008587494&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the issue's labels.</span>

---

## Iterating Fix Versions of an Issue

<span style="color: #0d0d0d">You can iterate over all fix versions to which the Issue belongs. </span>

<span style="color: #0d0d0d">The notation is:</span>

| **Versions Fields** | **Description** |
| --- | --- |
| Name | The version name |
| Description | The version description |
| Start date | Starting date of the version |
| Release date | Release date of the version |
| Archived | Boolean that indicates if the version is archived or not |
| Released | Boolean that indicates if the version is released or not |

### Sample Code

```
#{for FixVersions}
	${FixVersions[n].Name}
	${FixVersions[n].Description}
	${dateformat(“dd-MM-yyyy”):FixVersions[n].Start date}
	${dateformat(“dd-MM-yyyy”):FixVersions[n].Release date}
	${FixVersions[n].Archived}
	${FixVersions[n].Released}
#{end}
```

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_FixVersions.docx?version=1&modificationDate=1694008587591&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_FixVersions.xlsx?version=1&modificationDate=1694008587698&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the Issue's fix versions.</span>

---

## Iterating Affected Versions of an Issue

<span style="color: #0d0d0d">You can iterate over all affected versions to which the Issue belongs. </span>

<span style="color: #0d0d0d">The notation is:</span>

| **Versions Fields** | **Description** |
| --- | --- |
| Name | The version name |
| Description | The version description |
| Start date | Starting date of the version |
| Release date | Release date of the version |
| Archived | Boolean that indicates if the version is archived or not |
| Released | Boolean that indicates if the version is released or not |

### Sample Code

```
#{for AffectedVersions}
	${AffectedVersions[n].Name}
	${AffectedVersions[n].Description}
	${dateformat(“dd-MM-yyyy”):AffectedVersions[n].Start date}
	${dateformat(“dd-MM-yyyy”):AffectedVersions[n].Release date}
	${AffectedVersions[n].Archived}
	${AffectedVersions[n].Released}
#{end}
```

or

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

These documents demonstrate examples both in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_AffectedVersions.docx?version=1&modificationDate=1694008587819&cacheVersion=1&api=v2) and [Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_AffectedVersions.xlsx?version=1&modificationDate=1694008587930&cacheVersion=1&api=v2) templates that iterate over the Issue's affected versions.

---

## Iterating Project Versions

<span style="color: #0d0d0d">You can iterate over all project versions to which the Issue belongs. </span>

<span style="color: #0d0d0d">The notation is:</span>

| **Project Versions Fields** | **Description** |
| --- | --- |
| Name | The version name |
| Description | The version description |
| Start date | Starting date of the version |
| Release date | Release date of the version |
| Archived | Boolean that indicates if the version is archived or not |
| Released | Boolean that indicates if the version is released or not |

### 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}
	${ProjectVersions[n].Archived}
	${ProjectVersions[n].Released}
#{end}
```

or

```
#{for <VariableName>=ProjectVersionsCount}
   Content and Project Versions Mappings. Example: ${ProjectVersions[VariableName].Field}
#{end}
```

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_ProjectVersions.docx?version=1&modificationDate=1694008588029&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_ProjectVersions.xlsx?version=1&modificationDate=1694008588118&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the Issue's project versions.</span>

---

## Iterating Sprints

<span style="color: #0d0d0d">You can iterate over all sprints to which the Issue is associated. </span>

<span style="color: #0d0d0d">The notation is:</span>

| **Project Versions Fields** | **Description** |
| --- | --- |
| Name | The sprint name |
| Status | The sprint status |

### Sample Code

```
#{for sprints}
	${Sprints[n].Name}
	${Sprints[n].Status}
#{end}
```

or

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

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

---

## Iterating Issue History Entries

<span style="color: #0d0d0d">You can iterate over all of an issue's changelogs. </span>

<span style="color: #0d0d0d">The notation is:</span>

| **Project Versions Fields** | **Description** |
| --- | --- |
| Author | The user who made the change |
| Created | Date of the change |
| CreatedDate | Date of the change |
| CreatedDateTime | Date of the change |
| ChangedItemsCount | Number of items changed |

### Sample Code

```
#{for historyEntries}
	${HistoryEntries[n].Author}
	${HistoryEntries[n].Created}
	${HistoryEntries[n].CreatedDate}
	${HistoryEntries[n].CreatedDateTime}
	${HistoryEntries[n].ChangedItemsCount}
	#{for i=HistoryEntries[n].ChangedItemsCount}
		${HistoryEntries[n].ChangedItems[i].Field}
		${HistoryEntries[n].ChangedItems[i].From}
		${HistoryEntries[n].ChangedItems[i].To}
	#{end}
#{end}
```

or

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

<span style="color: #172B4D">These documents demonstrate examples both in </span>[Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Histories.docx?version=1&modificationDate=1694008588832&cacheVersion=1&api=v2)<span style="color: #172B4D"> and </span>[Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterations_Histories.xlsx?version=1&modificationDate=1694008588939&cacheVersion=1&api=v2)<span style="color: #172B4D"> templates that iterate over the Issue's changelogs.</span>

---

## Iterating Project Components

<span style="color: #0d0d0d">You can iterate over all project components, allowing you to access and utilize information related to each component. </span>

<span style="color: #0d0d0d">The notation is:</span>

### <span style="color: #0d0d0d">Sample Code</span>

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

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

These documents demonstrate examples both in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_ProjectComponents.docx?version=1&modificationDate=1694008589414&cacheVersion=1&api=v2) and [Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Iterating_Issue_ProjectComponents.xlsx?version=1&modificationDate=1694008589513&cacheVersion=1&api=v2) templates that iterate over the project components.

---

## Iterating Issues In Epic

<span style="color: #000000">All fields listed </span>[<span style="color: #000000">here</span>](http://confluence.xpand-addons.com/display/XPORTER/Mappings#Mappings-UsingMappings)<span style="color: #000000"> are available on IssuesInEpic[n] 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:

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

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

---

## Iterating JQL Queries

You can iterate over Issues that are the result of a [JQL Query](https://confluence.atlassian.com/display/JIRA/Advanced+Searching#AdvancedSearching-WhatisanAdvancedSearch?). <span style="color: #0d0d0d">The syntax is similar to other iterations, but it includes a </span>*<span style="color: #0d0d0d">clause</span>*<span style="color: #0d0d0d"> parameter that accepts the JQL query.</span> 

A few examples are provided below.

### 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}
```

### A more advanced example iterating the details of the Parent Issue from the current Subtask

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

```

These documents demonstrate examples both in [Word](https://docsxporter.atlassian.net/wiki/download/attachments/428318/JQL.docx?version=1&modificationDate=1694008588235&cacheVersion=1&api=v2) and [Excel](https://docsxporter.atlassian.net/wiki/download/attachments/428318/JQL.xlsx?version=1&modificationDate=1694008588343&cacheVersion=1&api=v2) Templates with JQL examples.

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

## Applying Filters to Iterations

<span style="color: #0d0d0d">If you wish to extend the previous iterations over comments, subtasks, and issue links to a higher level of control, you can utilize a JavaScript filter to specify which issues the iteration will encompass.</span>

This process 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>** the name of the variable to use as the iteration index.
- **<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.

> ℹ️ - The 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. For more information on formatters, see [Iterations](https://docsxporter.atlassian.net/wiki/spaces/XPORTERCLOUD/pages/428318).

This [document demonstrates an example of a template](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Links_with_Filter.docx?version=1&modificationDate=1694008589034&cacheVersion=1&api=v2) that iterates over Issue links and comments with filters being applied.

---

## <span style="color: #000000">Nested Iterations</span>

<span style="color: #0d0d0d">You can have multiple levels of iterations nested within other iterations. This can be useful if you want to iterate through the comments of each linked issue or the attached images for each subtask.</span>

### <span style="color: #0d0d0d">Sample Code</span>

```
#{for <VariableName1>=LinksCount}
  	#{for <VariableName2>=Iteration[n].Count}
		Content here	
	#{end}
#{end}
```

[<span style="color: #000000">This document</span>](https://docsxporter.atlassian.net/wiki/download/attachments/428318/Nested_iterations.docx?version=1&modificationDate=1694008589131&cacheVersion=1&api=v2)<span style="color: #000000"> demonstrates multiple scenarios where nested iterations can be useful.</span>

---

## Iterating in the same line of the document

<span style="color: #0d0d0d">You can also iterate values within the same line of the document. This can be useful if you want to display a list of subtasks or linked issues in the same line, separated by commas or spaces.</span>

<span style="color: #0d0d0d">Sample Code</span>

```
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 also iterate values within the same cell in an Excel document. You can achieve this by simply conducting your iteration within the confines of the same cell.

You can utilize all the iterations you are accustomed to and construct them in the same manner. The only difference is that you will be using just one cell to perform them.

### Sample Code

```
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 over anything, set up a conditional expression, and then utilize the *BREAK* and *CONTINUE* statements.

To do this, simply construct a standard conditional expression and insert the [mapping](https://docs.getxporter.app/space/XPORTERCLOUD/558575/Mappings) *#{break}* or *#{continue}* within it.

### Sample Code

```
Imagine that you have a Jira Issue that contains these comments:
- Hello
- World
- Greetings
- Hi
 
For the Break functionality, lets 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 it´s author. Next it will print the comment Body "World" but since the Conditional expression is true, it will stop the iteration all together and not print anything else.
Note: Anything after the #{break} mapping will not be printed in the exported document.
 
For the Continue functionality, lets 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 it´s 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

<span style="color: #0d0d0d">Imagine you have an iteration and want to sort it by any field that can be exported normally. This will serve as the header for such an iteration: </span>`#{for comments|sortby=<Iteration mapping>}`

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

### Sample Code

```
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}
```

## Sorting By Bulk Export

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

### Sample Code

##### **Sample Code**

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

> ℹ️ **Sorting Criteria**
> ℹ️ 
> ℹ️ - *asc *and *desc*can be defined to define how you want to sort your data.
> ℹ️ - The default value is *asc*.


> ℹ️ [Wiki] indicates that the field [supports wiki format](https://docs.getxporter.app/space/XPORTERCLOUD/527053).


<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/XPORTERCLOUD/18251779/In-App+Chat+Support).
</details>