Add Pivot Table for Findings with Text, Simple Source with Filter

We now want to insert a pivot table that shows the number of findings by specific codes in a workpack selected by the user during report generation. We want to add a heading and a description before the table. To do that, we create the following elements:

  • An Element Group for Findings, which will include the pivot table, text and heading. We will use this element group later for another findings-related element too.

  • A level-2 Section Heading

  • A Text (Paragraph) element to include a description

  • A Simple Source for the Finding system table, to which we add a filter for Workpack ID as a user parameter.

  • The actual Pivot Table

See the detailed steps below:

Prerequisites

You have completed the following steps:

Process

1. Insert an Element Group.

This element will contain the heading, text, pivot table and simple source that we are going to create for this section of the report.

  1. Add an Element Group element to the Report Layout structure. It should be on the same level as the element group you created for tasks.

    Tip

    If the element is not inserted to the right location in the element structure, use the Move Up or Move Down buttons in the toolbar to move them to the correct place.

  2. Double-click the element in the structure to edit it.

  3. Enter the name Findings, which will identify the element in the structure. You do not need to make other settings for the element group right now.

  4. Click OK.

2. Insert a level-2 Section Heading for the pivot table.

  1. Add a Section Heading element to the Report Layout structure so that it is included within the Findings element group.

  2. Double-click the element in the structure to edit it.

  3. Enter a name that identifies the element in the structure, for example, Findings Heading 2. This text does not appear in the actual report output.

  4. Enter the text of the heading that you want to see in the output in the Content field, for example, Number of Findings per Code.

  5. Select the Include in Table of Contents checkbox to have this section heading appear in the Table of Contents.

  6. In the Default Style field, select Heading 2, which is a preconfigured style that can be applied for level-2 section headings. If required, you can set up your own style and apply that instead (see Styles).

  7. Click OK.

3. Insert a Simple Source for the Pivot Table.

This simple source will be used as the data source for the pivot table that calculates the number of findings per code in a user-specified workpack. We also set up a filter with a user parameter for Workpack ID to allow users selecting the required workpack during report generation.

  1. Add a Simple Source element to the Report Layout structure so that it is included within the Findings element group. The Simple Source element is located under the SOURCES node within the Template Definition section of the dialog.

Note

You must insert the simple source within the element group, else, you cannot refer to it from the other elements of the element group.

  1. Double-click the Simple Source element in the structure to edit it.

  2. Specify the name Finding* for the simple source.

  3. In the Table field, click the ellipsis ellipsis to select the System Table Finding.

  4. On the Filters tab, create a new filter with the following data:

    • Field: Workpack (available from the drop-down list since it’s a field within the source)

    • Comparison: =

    • Parameter: User

    • Value: Workpack_ID

  5. Click OK.

    _images/report.template.workpack.simplesource.task.png

4. Insert a Text (Paragraph) element for introduction.

You want to insert an introductory text to the report before the pivot table. You want this text to include the workpack ID that the user selects when generating the report, thus, it has to be a variable. To do that, you add a Text (Paragraph) element as shown below:

  1. Add a Text (Paragraph) element to the Report Layout structure so that it is included within the Findings element group and it comes after the Section Heading element.

  2. Double-click the new element in the structure to edit it.

  3. In the Content field, enter text as follows:

    1. Enter The following table shows the number of findings for each code within the workpack .

    2. Right-click and choose Parameters ‣ Workpack (Workpack_ID) to select the user parameter that you have added to the Simple Source earlier.

  4. Click OK.

5. Insert a Pivot Table for Findings.

We want the pivot table to show the number of findings per codes in the workpack that the user selected.

  1. Add a Pivot Table element to the Report Layout structure so that it is included within the Findings element group.

  2. Double-click the element in the structure to edit it.

  3. In the top part of the Edit Pivot Table dialog, enter data as follows:

    • Name: Enter Number of Findings per Code or any name that identifies the element in the structure.

    • Show Caption: Tick to add the name of the pivot table as a caption.

    • Show Column Totals: Tick to add a row that shows the total number for each column.

    • Show Zero Values: Tick to show values even if it is 0. If you disable this option, any values that would have shown “0” will be replaced with a blank.

    • Show Rows with All Zero/Blank Values: Tick so that if a row contains “0” value or no value at all, it will be shown in the output.

    • Source: Select Finding.

  4. Under the Pivot section of the dialog, make settings as follows:

    1. In the Rows section, choose Add.

    2. Double-click in the new row that has been added and select Code. The available fields in the drop-down list are retrieved from the Source that you have selected above. This setting determines that the rows of the pivot table will correspond to the values of the Code field.

    3. In the Values section, we set up what we want to be calculated and based on which field. In our case, we want to count the number of findings, so the field based on which we want to perform the calculation will be Finding_ID, which is unique to each finding record. Thus, make settings for the corresponding columns as follows:

      • Field: Select Task_ID.

      • Aggregate: Select Count.

      • Aggregate (Total): Select Count.

      • Name: Enter No. Finding. Since we now have only one parameter based on which we calculate the values (Code), this will be the title of the column that shows the numbers for each code.

  5. Click OK.

    _images/report.template.workpack.pivot.finding.png

Result

When you generate the output, you can see that the pivot table has been inserted and it shows the calculated number of findings for each code within the workpack. The text above the pivot table shows the workpack ID that you selected when generating the report.

_images/report.template.asset.pivot.finding-output.png

Proceed to Next Step next