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

In this exercise, you'll learn how to populate the sum of the worklogs for all subtasks.

You have to use a set function to create a variable called sumworklogged and initialize it to zero.

${set(sumworklogged,0)}

As explained in previous exercises, if you want to display your iteration as a Table with a Header, you must first create the Header using a table with 3 columns and 1 row:

KeyTimeSpentSum TimeSpent

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

SubtasksCount will return the number of subtasks you have in the issue being exported.

Inside the subtasks iteration, another iteration for the worklogs is going to print the time spent in all subtasks in the issue.

Put the #{for s=Subtasks[n].WorklogsCount}.

For a list of all fields available for the iteration of worklogs, check here.

Then, create another table where the Subtask Issues worklogs will be populated:

${Subtasks[n].Key}%{Number(${Subtasks[n].Worklogs[s].Time Spent})/3600}

${set(sumworklogged,%{(Number(${Subtasks[n].Worklogs[s].Time Spent})/3600) + Number(${sumworklogged})})}${sumworklogged}

The second column above is going to give the Time Spent in hours.

The third column above is going to give the sum of Time Spent in hours.

When entering each iteration, the Time Spent will be summed with the value from the last iteration. On the very first iteration, that value is zero.

Finally, close the two statements using the mapping #{end}.

Take into account that you've only got the worklogs from the subtasks. Now, we are going to get the worklog of the main issue and obtain the total log work of the issue with its subtasks.

Create the Header using a table with 3 columns and 1 row:

KeyTimeSpentSum TimeSpent

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

Create another table where the Issue worklogs will be populated:

${Key}%{Number(${Worklogs[n].Time Spent})/3600}${set(sumworklogged,%{(Number(${Worklogs[n].Time Spent})/3600) + Number(${sumworklogged})})}${sumworklogged}

Finally, close the statement using the mapping #{end}.

Don't forget to create an issue of type Story (or whatever type you want). Then, create subtasks for that issue.

The time tracking has to be configured on your project and there has to be logged work on the issue to export and/or its subtasks.

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

This Template has:

  • A header with an image
  • Headings
  • Text styling

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

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
Exercise6Template

Exercise 6 Sample Template file

Exercise6GeneratedExercise 6 Sample generated file
  • No labels