This is the first exercise, you'll learn how to iterate with the BREAK or CONTINUE statement on an Xporter generated file.
Info |
---|
For the break functionality, lets say that you want to stop the iteration. For the continue functionality, lets say that you want to skip to the next iteration. |
Let's go to create the template.
How you learned on the intermediate level use the set function, on this exercise we are going to put into practice on the first line.
${set(count,0)}
And below it you put the #{for comments} or #{for <VariableName>=CommentsCount} statement.
Then you put the set function to count +1, because when entering the iteration sums +1 in your count. After that, it calls the mapping that initialized on the set function.
${set(count,%{${count} + 1 })} |
Let's put the mappings that we want to print on the template.
Author | ${Comments[n].AuthorFullName} |
Body | ${Comments[n].Body} |
Now, We are going to use the function continue with a conditional block, when the comment is equal a "Hello Continue".
Code Block | ||||
---|---|---|---|---|
| ||||
#{if (%{'${Comments[n].Body}'.equals('Hello Continue')})}
Jump the next comment.
#{continue}
#{end} |
Info |
---|
We must have comments on your issue and a comment with "Hello Continue". |
On this case is a template on Excel, so don't forget the note below.
Since all the table contents below the Header are dynamic, firstly we need to create a single row Table to be the Header, and below it you put the &{for issues...} statement, so the Header is printed only one time.
Using a XLSX template, please take note that to define an iteration for multiple columns, you need to merge a row of columns and define the &{for issues...} inside that merged cells. The same thing should be made to define the &{end} of the same iteration. All content between the &{for issues...} definition and the &{end} won't be duplicated for each iteration.
With that done, you create another row table where the Issue Comments will be populated:
${IssueTypeName} | ${Key} | ${Summary} | %{Number(“${OriginalEstimate}”/3600)} | %{Number(“${RemainingEstimate}”/3600)} | %{Number(“${TimeSpent}”/3600)} |
Finally close the statement using the mapping #{end}.
Well, the first sheet was completed. Let´s go to the second sheet.
We are going to create a pivot table.
A pivot table allows you to extract the significance from a large, detailed data set.
- To create a pivot table click on the first cell inside the header.
- On the Insert tab, click PivotTable
- A Dialog box appears. Excel automatically selects the data for you. The default location for a new pivot table is the New Worksheet.
- Click ok. The second sheet was created.
Now, The PivotTable fields list appears.
- The Field Key we are going to drag on the Rows.
- Estimated (Hours) we are going to drag on the Values.
- The Remaining (Hours) and Logged (Hours) we are going to repeat the step 2.
- For each Estimated (Hours), Remaining (Hours) and Logged (Hours) on the Values, we are going to set up a configuration.
- The configuration is right click and click on Value Field Settings.
- Choose the type of calculation you want to use. We are going to use the Sum.
- Click ok.
The configuration of pivot table is done but you are going to add a chart.
- Select all pivot table.
- On the Insert tab, click charts. You can pick up all chart. On this case, I am going to choose the 2-D Column.
- The chart appears on the sheet.