In this page, it's explained how to export a property when it has more than a single value such as:
The Document Generator also provides data filtering and sorting directly on the iteration definition. Read the following topics:
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:
Activity Fields | 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 |
We suggest that you use the html function to render the data because almost all content is HTML, e.g., ${html:ActivityEntries[n].Title}
Below are two examples of using the Activity iteration in a Word and Excel template:
Iterating_Activity_Entries.docx
Iterating_Activity_Entries.xlsx
Issue History
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.
Exportable Data
Field | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
HistoryEntriesCount | Returns the number of changes made | ||||||||
Author | Returns the user who made the change | ||||||||
Created | Date of the change | ||||||||
TestVersion | In the case of Xray Tests, it outputs the Test version where the change was made (if applicable) | ||||||||
ChangedItemsCout | Returns the number of fields changed in the current change | ||||||||
ChangedItem |
|
The notation is:
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.
Exportable Data
Field | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AppType | Returns the Application Type. The values can be:
| ||||||||||
LinkType | Returns the Link Type. |
Note: When the link you are iterating is of AppTypes External Jira or Confluence, the name is obtained using the Summary property.
The notation is:
The documents below demonstrate an example of a template that iterates over linked Issues.
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:
Comments Fields | 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 |
The documents below demonstrate an example of a Word template that iterates over Issue comments.
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:
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 |
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 Tempo Timesheets plugin) |
BilledHoursFormatted | The billed hours as displayed on Jira (Belongs to Tempo Timesheets plugin) |
Issue Sub-Tasks
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:
Subtasks Fields | Description |
---|---|
Key | The key of the subtasks |
Summary | The summary of the subtasks |
AssigneeUserDisplayName | The assignee user of the subtasks |
The documents below demonstrate an example of a template that iterates over Issue subtasks.
For an example of how to iterate the details of a subtask Parent Issue, please check the Iterating JQL Queries area below.
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:
Components Fields | 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 |
The documents below demonstrate an example of a template that iterates over Issue components.
Iterating_Issue_Components.docx
Iterating_Issue_Components.xlsx
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:
Status Transitions Fields | 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 |
The documents below demonstrate an example of a template that iterates over status transitions.
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:
Attachments Images Fields | 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 |
The image below demonstrates an example of a Word template that iterates over attached images.
Document Generator 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 to your template.
These values are in pixels and if you only define one of them the image will be rescaled.
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.
The documents below demonstrate an example of an Excel template that iterates over attached images.
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:
Attachments Fields | 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 attachment |
The documents below demonstrate an example of a template that iterates over attachments.
Iterating_Issue_Attachments.xlsx
Issue Labels
Because it is not known in advance how many labels exist in an Issue, you can iterate a section over all the labels of an Issue. The notation is:
Attachments Fields | Description |
---|---|
Name | The name of the label |
#{for labels} ${Labels[n].Name} #{end} or #{for <VariableName>=LabelsCount} ${Labels[VariableName].Name} #{end}
The documents below demonstrate an example of a template that iterates over labels.
Project Versions
You can iterate over all project versions to which the Issue belongs. The notation is:
Attachments Fields | 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 |
#{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}
The documents below demonstrate an example of a template that iterates over the project version.
Iterating_Issue_ProjectVersions.docx
Iterating_Issue_ProjectVersions.xlsx
Iterating JQL Queries
You can iterate issues that are the result of a JQL Query. The syntax is similar to the other iterations, but there is a clause parameter that will receive the JQL Query. A few examples are provided below.
The documents below demonstrate an example of a template that iterates over Issue Subtasks.
You can also use a Filter Name or a Filter ID as a clause. For more info, read this.
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:
- VariableName is the name of the variable to use as the iteration index.
LinksCount|SubtasksCount|CommentsCount indicates which type of entities you want to iterate.
- Filter indicates the filter to be applied in the iteration.
Notice that the filter is evaluated as a JavaScript expression, which provides flexibility in the definition of the conditions. You can use and (&&), 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 Native Iterations.
The image below demonstrates an example of a template that iterates over Issue links and comments with filters being applied.
Links Bugs with High Priority:
Nested Iterations:
Iterating in the same line of the document
You can also possible to 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.
Iterating in the same cell in an Excel document
You can also 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.
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.
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 are able to get all the information from a parent issue. To get those fields, you just need to have the following definition:
${Parent.<Field>} |
Example:
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>} |
NOTE: The mapping after the "sortby" must be equal to the supported mappings for each Iteration.
Example:
Sort By on multi issue export
The sortby can also be used to sort a &{for issues} iteration on a Bulk Export.
Sorting Criteria
asc and desc can be defined in order to define how you want to sort your data. The default value is asc.