Making a List of Pages by Displaying Only a Part of the Title
Scenario
Combining Text Supplier with Collection Supplier is useful in returning specific text you need from a collection of data (lists, sets and arrays).
In this example, we are building a report that extracts IT personnel's name from every page title under the same parent page. This is useful if you're compiling a list of names from many children pages into a single page.
This recipe will allow you to build the report on the IT Personnel page and extract the personnel's name from the children page titles (after the hyphen) to be displayed in the report.
Result
Recipe
Apps | Reporting for Confluence Server & Data Center |
---|---|
Level | Intermediate |
Estimated time | 15 minutes |
Macros | Content Reporter, Report Body, Report Info, Report List, Text Filter |
Suppliers | Collection Supplier, Content Supplier, Text Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<ac:structured-macro ac:macro-id="e85392ae-e50c-49df-ae00-9364691de47b" ac:name="report-list" ac:schema-version="1">
<ac:rich-text-body>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="1a768800-5d12-4c5a-bef9-cb34b781d064" ac:name="content-reporter" ac:schema-version="1">
<ac:parameter ac:name="types">page</ac:parameter>
<ac:parameter ac:name="scope">IT Personnel > children</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="3394127e-a9e0-412a-bb1b-10bd065bad87" ac:name="text-filter" ac:schema-version="1">
<ac:parameter ac:name="">content:title</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="c76b6fce-07c6-4b31-a14b-7d0db3a661d0" ac:name="report-body" ac:schema-version="1">
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="4deaa53e-72e6-4488-ad4c-9ab3b46965e2" 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="">content:title > text:split with - > collection:last</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<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
Add a report-list macro.
Add the content-reporter macro within a report-list macro and specify the following:
- Spaces:@self
- Types:page
- Scope:IT Personnel > children
- Match All Criteria:true
Add a text-filter macro within content-reporter macro and specify the Key as
content:title
.Add a report-body macro within the report-list macro.
Add a report-info macro within the report-body macro and specify the Key as
content:title > text:split with - > collection:last.
Save the page.
Line-by-Line Explanation
N/A