Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

As you know, you You have to use a set function to create a variable called sumworklogged and initialize it as to zero.

Code Block
${set(sumworklogged,0)}

...

KeyTimeSpentSum TimeSpent

And below you Below it, put the #{for subtasks} or #{for <VariableName>=SubtasksCount} statement, so the Header is printed only one timeonce.

Info

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

Inside the subtasks iteration, another iteration for the worklogs is going to print the time spent of in all subtasks that you have on in the issue.

So now you put Put the #{for s=Subtasks[n].WorklogsCount}.

Info

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

With that doneThen, you must create another table where the Subtask Issues worklogs will be populated:

...

Info

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

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

When entering each iteration, the Time Spent will be summed with the one value from the last iteration. However, on On the very first iteration, the that value starts at 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.

As you know, you must create Create the Header using a table with 3 columns and 1 row:

KeyTimeSpentSum TimeSpent

And below you Below it, put the #{for worklogs} or #{for <VariableName>=WorklogsCount} statement, so the Header is printed only one timeonce.

Now, you must create 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}.

Info

Don't forget to create an issue of type story Story (or whatever type you want. On the issue that you have created, you must create subtasks). 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 there is a sample of how the mappings will be displayed in an Excel template:

...

  • A header with an image
  • Headings
  • Text styling

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

...