Scenario
A report that shows the count of all direct children pages and descendant (indirect children) pages of a On this page:
|
---|
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
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:
In Confluence or Jira, click on the People tab, and either select or search for the user you are interested in. View their profile.
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.
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
...
To build the report shown in the Result section above, follow these steps:
Create a new Confluence page, add a Reporting macro, and give the page a suitable title.
In the Query section on the left, set up the parent page query by typing the Confluence Query Language (CQL) syntax. For this example, use:
type=page AND title="Get Started"
Click Search to confirm the query matches your parent page.In the Add Expansions section, check the following boxes to retrieve child and descendant pages:
children > page
descendants > page
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.
Go to Add Report Blocks, select Basic, then Add block.
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:
Add another block for the Direct Children Countcolumn, title it Direct Children Count, and set the Value to
content.children.page.size
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.
Check the Preview and Save your report.
The final block configuration should appear as shown in the screenshot below:Publish the page, and you're done.