Create a space inline comment report with a Scaffolding dropdown selector for the space

Create a space inline comment report with a Scaffolding dropdown selector for the space

Scenario

This recipe allows you to create an inline comment report for a specific Confluence space. 

To make this report dynamic and allow users to select which space to report on, we are using Scaffolding Forms & Templates for Confluence Data Center's List Data macro to appear as a dropdown menu with all available spaces for users to select from. Once a user selects a space, the inline comment report for that particular space will be executed.

Without the Scaffolding List Data macro used in this example, users will need to edit the page and change the Spaces value in the Content Reporter macro to select which Space to report on.

Result

Recipe

Apps

Reporting for Confluence Data Center, Scaffolding

Level

Intermediate

Estimated time

30 minutes

Macros

Content Reporter, Report Block, Report On, Report Table, Report Variable, Space Reporter, Text Filter

Suppliers

Comment Supplier

Storage format

You can copy and paste this code into the Confluence Source Editor:

<ac:layout> <ac:layout-section ac:type="single"> <ac:layout-cell> <table class="wrapped"> <colgroup> <col /> <col /> </colgroup> <tbody> <tr> <td>Please select the Space you wish to report on:</td> <th> <div class="content-wrapper"> <ac:structured-macro ac:macro-id="8aa7e2e6-8f3d-4098-b375-6d91c143c339" ac:name="list-data" ac:schema-version="1"> <ac:parameter ac:name="name">spaces</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="56680a6a-b074-4c13-8a56-66ebbd93a4e6" ac:name="report-block" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="6f1f33d7-7888-4d5d-8ce2-f70f65bf0ce0" ac:name="space-reporter" ac:schema-version="1"> <ac:rich-text-body> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="cefedb5e-86e2-4b5e-85f5-b0b895139e27" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="5c212908-639d-4e0f-9709-52fc58cc9285" ac:name="list-option" ac:schema-version="1"> <ac:parameter ac:name="label">%space:name%</ac:parameter> <ac:parameter ac:name="value">%space:key%</ac:parameter> <ac:rich-text-body> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> </div> </th> </tr> </tbody> </table> </ac:layout-cell> </ac:layout-section> <ac:layout-section ac:type="single"> <ac:layout-cell> <ac:structured-macro ac:macro-id="f8e413f3-26c8-47ac-b5d5-579e979d43b4" ac:name="report-table" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="7356aed7-4a90-459e-9805-a8b2837a5222" ac:name="content-reporter" ac:schema-version="1"> <ac:parameter ac:name="types">comment</ac:parameter> <ac:parameter ac:name="spaces"> <ri:space ri:space-key="%data:spaces>first%" /> </ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="1ea4eeca-aeeb-4688-9692-ea7e7b127754" ac:name="text-sort" ac:schema-version="1"> <ac:parameter ac:name="">comment:creation date</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id="c7c614dd-138e-4b14-ab84-8e98d54d2033" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="exclude">Resolved</ac:parameter> <ac:parameter ac:name="required">true</ac:parameter> <ac:parameter ac:name="">comment:inline-status</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="2f760e10-32d4-406d-a00e-b003c5f7f0e7" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Space</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="1221e78a-4dd1-4877-a103-a7e48f564763" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">comment:space</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="a706f2fa-45eb-4e98-b5f5-85b4840dcf37" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Page</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="b6167193-29e7-426d-8bc4-0709916e9640" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="">comment:page</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="c0d0df5a-732f-42bd-b83a-bf427511dc17" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Comment</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="5bec0898-7e9a-43c0-b146-4a3efc81f0a6" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="link">true</ac:parameter> <ac:parameter ac:name="render">richtext</ac:parameter> <ac:parameter ac:name="">comment:body</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="0589b942-6cc0-4b5b-8118-429459297cd7" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Author</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="dcf3eb45-d53c-479a-b8b2-045389ab6078" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">comment:creator</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="391fac60-a473-461f-a3d5-0d7cd7f97261" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Repliers</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="ed3e6c5a-5ea0-42de-a865-f51defeea9d9" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">comment:repliers &gt; collection:join with ", "</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="6a37b846-f71d-4419-ab18-3927e07e1d28" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Status</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="ac7d2c62-6aee-4242-ad38-e0f2fb89c38a" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">comment:inline-status</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="54762b7e-3c64-4f5c-b15f-928e44d7a266" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">ReplyCount</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="8c46af56-32b3-43a4-8076-2e3a9f2eb148" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">comment:reply count</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <ac:structured-macro ac:macro-id="8377ba93-0a47-48e1-bedb-8d0b7964c3a5" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="title">Age</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="2ec6bc9c-c733-4f4f-99ed-47fd5167645c" ac:name="report-eval" ac:schema-version="1"> <ac:parameter ac:name="format">#</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:plain-text-body><![CDATA[(%global:current date>date:milliseconds% - %comment:creation date>date:milliseconds%)/1000/60/60/24]]></ac:plain-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> </ac:layout-cell> </ac:layout-section> </ac:layout>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a List Data macro (from the Scaffolding app) for the user to select the space they want to report on.

  2. Within the List Data macro, create a Report Block macro with Injected: selected.

  3. Within the Report Block, create a Space Reporter macro to report on all the spaces in the Confluence instance.

  4. Within the Report Block, under the Space Reporter macro, create a Report Body macro.

  5. Within the Report Body macro, add a List Option macro (from the Scaffolding app) with the following parameters to feed the spaces into a dropdown menu:

    • Value: %space:key%

    • Label: %space:name%

  6. Outside the List Data macro, create a Report Table macro with Injected: selected.

  7. Within the Report Table macro, create a Content Reporter macro with the following parameters:

    • Type: comment

    • Spaces%data:spaces>first%

  8. Within the Content Reporter macro, create a Text Sort macro with Key: comment:creation date.

  9. Within the Content Reporter macro, under the Text Sort macro, create a Text Filter macro with the following parameters:

    • Key: comment:inline-status

    • Required: selected

  10. Within the Report Table macro, under the Content Reporter macro, create seven Report Column macros with nested Report Info macros with the following parameters:

Report Column macro parameters

Nested Report Info macro parameters

Report Column macro parameters

Nested Report Info macro parameters

Title: Space

Key: comment:space

Title: Page

  • Key: comment:page

  • Link To Item: selected

Title: Comment

  • Key: comment:body

  • Link To Item: selected

Title: Author

Key: comment:creator

Title: Repliers

Key: comment:repliers > collection:join with ", "

Title: Status

Key: comment:inline-status

Title: Reply Count

Key: comment:reply count

  1. Under the Reply Count Report Column macro, create another Report Column macro with the following parameters:

    • Title: Age

    • Injected: selected

  2. Within the Age Report Column macro, create a Report Eval macro with Format: #.

  3. Within the Report Eval macro body, enter the following

    (%global:current date>date:milliseconds% - %comment:creation date>date:milliseconds%)/1000/60/60/24.
  4. Save the page.

Now, you can click Edit Contents to select the space to report on.