Versions Compared

Key

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

Scenario

A report that shows the count of all direct children pages and descendant (indirect children) pages of a On this page:

Table of Contents
minLevel1
maxLevel6
outlinefalse
styledefault
typelist
printabletrue

Scenario

Create a report showing the number of direct child pages and all descendant pages of a specified parent page.

Result

...

Recipe

Apps

Reporting for Confluence Cloud

Macros

Reporting

Estimated time

5 minutes

Steps

To build the report shown in the Result section above, follow these steps:

  1. Create a new page for the report Confluence page, add a Reporting macro, and give it the page a suitable title. Then insert a Reporting macro.

  2. In the Reporting window, under Query, type Query section on the left, set up the parent page query by typing the Confluence Query Language (CQL) syntax that will allow you to search for the parent page, whose children and descendants you want to report on. Refer to this Atlassian article for more information on the CQL syntax.
    The example CQL below. For this example, use: type=page AND title="Get Started"will match all pages with the title "Get Started" in the current space.
    Click Search and to confirm that your CQL syntax is matching the the query matches your parent page.

  3. Now continue to In the Add expansionsExpansions section, which helps you retrieve more data from your query. Check check the following boxes to retrieve all children child and descendants descendant pages of the “Get Started” page:

    • children

    and then page after expanding under children, similarly descendants and then page after expanding.
    • > page

    • descendants > page

      reporting-cql-expansions.pngImage Modified
  4. We'll Now, start by building the first column for the report (leftmost column), which will contain the employee’s name.

    1. In the dropdown, Choose Scaffolding, then click on Add.

      Image Removed
    2. Click on "Block 0", then under Title, key in "Name", and under Field Group Name, select the correct Field Group from the list. For this example, it is "profile_group". 

      Image Removed
    3. Continue by clicking on Field Name. A list of fields will appear. Select the field that matches the title. For this example, it is "employee_name". Click Update to continue.

      Image Removed
  5. Next, we'll add the second column for the report, which will display employees' positions.

    1. Again, choose Scaffolding in the dropdown, then click on Add.

      Image Removed
    2. Click on "Block 1", then under Title, key in "Position", and under Field Group Name, select the correct Field Group from the list. For this example, it is "profile_group". Click on Field Name. A list of fields will appear. Select the field that matches the title. For this example, it is "employee_position". Click Update to continue.

      Image Removed

  6. Repeat step 7 for the two remaining columns, "Start date" and "Employee ID". Make sure you match the field to the title each time.

  7. Under Report Type, choose Table (the default). Then, we'll add some error handling by filling out the Empty Report section. This text is shown if the report has no results. For this example, we'll enter "No matching profiles were found. Please try again later." You will also see a preview of the report here.

    Image Removed
  8. Save your report, Publish the page, and you're done.

Steps

The template mentioned above will generate a report on content created by you. This is specified by a section of the CQL query which is, creator=currentUser().

You can easily create a report on content created by another user just by changing the creator value to the user's account ID. For example, if the user account ID is 621dabxxxxx4c0070ad1fe7,  then the CQL should be:

creator="621dabxxxxx4c0070ad1fe7"

...

You can obtain a user's account ID by following these steps:

  1. In Confluence or Jira, click on the People tab, and either select or search for the user you are interested in. View their profile.

    Image Removed

  2. The URL of their profile page will include their user account ID at the end. It will look a like string of random letters and numbers. You can copy this string and use it for CQL queries.

    Image Removed

Notes

Info

This recipe is now part of Reporting's built-in templates. You can easily load it into your page by using the templates feature.

...

Note

By default, the report is limited to 200 results. Enable Get all results below the search box if you need to view more results. 

Caveats

...

  1. columns of your report. To display the Parent page title in the first column, go to the Add report blocks section to add the first block, which will also be your first column.

    1. Go to Add Report Blocks, select Basic, then Add block.

    2. For Block title, type Parent page, and set the Value to content.title.

      Look at the screenshot to see how the block’s settings and preview should appear:

      Details of the first report block are shown, including the block title and value, with a preview of the first block displayed below.Image Added
  2. Add another block for the Direct Children Countcolumn, title it Direct Children Count, and set the Value to content.children.page.size

  3. Finally, add the block for the third column, title it All Descendants Count, and set the Value to content.descendants.page.size

Descendants include both direct and indirect children. So, if the Get Started page has 5 pages under it (at any depth), the descendants count will display 5.

  1. Check the Preview and Save your report.
    The final block configuration should appear as shown in the screenshot below:

    The final block configuration showing three configured blocks in the blocks' section and the three relevant columns in the Report Preview section Image Added
  2. Publish the page, and you're done.