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. Let’s build the first column for the report (leftmost column), which will contain the Parent page. Go Now, start building the 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 too.

    1. Make sure that Basic is selected in the dropdown, then click on Go to Add Report Blocks, select Basic, then Add block.

    2. Click on the Block box and type Parent Page next to Block title and next to Value, select content.title to show the title of the parent page. For this example, it is Get Started.  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.

    Next, let’s add the second column of the report, which displays the count of direct child pages under the Get Started (parent) page.

  5. Again, under Add report blocks choose Basic in the dropdown, then click on Add block.

  6. Click on the Block box and type Direct Children Count next to Block title and next to Value, select
  7. Add another block for the Direct Children Countcolumn, title it Direct Children Count, and set the Value to content.children.page.size

    to show the number of direct children of the Get Started page. For this example, it is 3.  

    Repeat step 5 for the last column, which displays the count descendant pages (indirect children) under the Get Started (parent) page. Type All Descendants Count for the Block title and choose

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

Note that descendant pages also Descendants include both direct and indirect children pages in their count. This means that if under . So, if the Get Started Page, you have five total pages page has 5 pages under it (at any depth), the descendants will show that you have five pages under the Get Started page, no matter if they are direct children pages or you need to drill down 3 levels to reach themcount 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.

...