Let's generate a report based on staff profile pages. In this tutorial, we'll show you how to create a report which extracts data from profile pages that were created using Scaffolding.
We're interested in extracting four types of data from each profile - name, position, start date, and employee ID.
Then we will generate a report which looks like this:
Reporting for Confluence CloudScaffolding for Confluence Cloud
The profile pages should all use the same Scaffolding Field Group name and field names. Ideally, your pages should have been created from a template or a live template.
The Scaffolding Field Group name and field names should be recognizable and legible to you. By default, Scaffolding does not use these names so it just generates semi-random ones. You can edit these names in the Field Group settings.
Reporting can extract data from these Scaffolding fields - Custom List, Date, Number, Paragraph, and Short Text.
Scaffolding Cloud fields support is a beta feature, and your administrator must first enable it in the app's configuration.
Building the report
You will first need to compile a list of the Field Group name and field names used in profile pages. Edit any one of these pages.
Take note of the Field Group name used on the profile page. It is listed under Scaffolding's Field Group settings. In this example, the name is "profile_group".
You will also need to note the field names for each field you are interested in. Click on Field settings to expand it, then click on each field on the right to note its Field name. In the two examples shown below, the field names are "employee_name" and "employee_position" respectively.
After you have noted all the field names, create a new page for the report and give it a suitable title. Then insert a Reporting macro.
In the Reporting window, start with some simple CQL syntax and search for the profile pages you want to report on (refer to this page for more information on the CQL syntax). The example below will match all pages with the label "profile_page". Click Search and confirm that your CQL syntax is matching pages.
Now continue to the Report Builder section. We'll start by building the first column for the report (leftmost column), which will contain the employee’s name.
In the dropdown, Choose Scaffolding, then click on Add.
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".
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.
Next, we'll add the second column for the report, which will display employees' positions.
Again, choose Scaffolding in the dropdown, then click on Add.
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.
Repeat step 7 for the two remaining columns, "Start date" and "Employee ID". Make sure you match the field to the title each time.
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.
Save your report, Publish the page, and you're done.
This recipe is now part of Reporting's built-in templates. You can easily load it into your page by using the templates feature.
By default, the report is limited to 200 results. Enable Get all results below the search box if you need to view more results.