Tracing Nested References with Reporting

Scenario

Given three ServiceRocket Scaffolding templates that form a hierarchy of references (using List Data fields):

  1. Customer

  2. Orders (contains a List Data macro field, and the Key parameter is set to data:Customer, referencing pages made with the Customer template)

  3. Shipment (contains a List Data macro field, and the Key parameter is set to data:Order,  referencing pages made with the Orders template)

This recipe is an example of how to report all shipments associated with a customer.

Result

  • N/A

Recipe

Apps

Reporting for Confluence Server & Data Center, Scaffolding

Apps

Reporting for Confluence Server & Data Center, Scaffolding

Level

Advanced

Estimated time

30 minutes

Macros

Local Reporter, Report Block, Report Body, Report Info, Report List, Text Filter

Suppliers

Page Supplier, Report Supplier, Text Supplier

Storage format

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

<ac:structured-macro ac:macro-id="0d583032-21d0-4641-954b-e7863bde69ca" ac:name="report-block" ac:schema-version="1"> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="fccb981d-8d91-4822-8c4c-f9a2ddf5d4c5" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="source">Orders</ac:parameter> <ac:parameter ac:name="">page:children</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="fc5a94a0-b1a1-40ab-bb34-8dba261adeaf" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">MyCustomerName</ac:parameter> <ac:parameter ac:name="">data:Customer</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="b34a9646-f2f4-4794-a8ba-a3f7f6a749f4" ac:name="report-body" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="d28f2816-2d85-491a-95d8-dc1c3dd0273e" ac:name="report-list" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="81d48de4-2422-4f34-b209-521aecc7b02f" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="source">Shipments</ac:parameter> <ac:parameter ac:name="">page:children</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="fb2619d0-b5f8-491b-b623-fc3fa5ef6ff1" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">%page:title%</ac:parameter> <ac:parameter ac:name="">data:Order</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="e2eeb4ca-df19-4b32-a2e9-eaedaeeceeb5" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="7f6cc26c-113c-484c-a686-8bbd208538a1" ac:name="report-list" ac:schema-version="1"> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <ac:structured-macro ac:macro-id="b4c719b7-278a-40fb-9dec-e00c2bfec6ce" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">page:title</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Report Block macro. This macro will contain all macros we will create.

  2. Create a Local Reporter macro. Set the following parameters:
    Key: page:children
    Source: "Orders"

  3. Create a Text Filter macro within the Local Reporter we created in the previous step. Set the following parameters as stated:
    Key: data:Customer
    Include: "MyCustomerName"

  4. Within the Report Block macro, but outside the Local Reporter macro, create a Report Body macro and check the Injected parameter to set it to True.

  5. Within the Report Body macro, create a Report List macro, and check the Injected parameter to set it to True.

  6. Within the Report Body macro, create another Local Reporter macro. Set the following parameters as stated: 
    Key: page:children
    Source: "Shipments"

  7. Within the Local Reporter macro created in the previous step, create a Text Filter macro. Set the following parameters as stated:
    Key: data:Order
    Include: %page:title%

  8. Outside the Local Reporter macro (created in step 7), create another Report Body macro.

  9. Within the Report Body macro, create Report Info macro and set the Key to page:title.

  10. Outside the Report Body macro (created in step 6), create a Report List macro.Â