Split report results that have special characters
Scenario
This recipe will allow you to separate report results based on a special characters included in the content.
In this example, a text separated by a hyphen ( - ) will be split into three separate columns.
Result
Recipe
Apps | Reporting for Confluence Server & Data Center |
---|---|
Level | Easy |
Estimated time | 10 minutes |
Macros | Content Reporter, Report Column, Report Info, Report Table, Text Sort |
Suppliers | Collection Supplier, Content Supplier, Text Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="6a327ceb-143f-4973-8e90-98250933cde3" ac:name="report-table" ac:schema-version="1">
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="0da2650e-ee4c-4248-b893-edd55dbd77c6" ac:name="content-reporter" ac:schema-version="1">
<ac:parameter ac:name="types">page</ac:parameter>
<ac:parameter ac:name="scope">Employee Directory > children</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="4ce3d743-c0ef-4a66-a4c5-27ff4e0fec81" ac:name="text-sort" ac:schema-version="1">
<ac:parameter ac:name="">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="7ec1383a-067c-40c2-b31a-d6638a8e6798" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Page Title</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="69d3df87-7d91-4bd4-8bad-1989e26e1bcf" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">content:title > text:split with - > collection:1</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="8be0ef50-29ed-48de-81c7-8e518e191604" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Department</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="f29d282c-47c0-42a4-9e44-42ff154e0cae" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="separator">newline</ac:parameter>
<ac:parameter ac:name="">content:title > text:split with - > collection:2</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="b8675e9a-2feb-473f-8758-312ec0c568e9" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Date Joined</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="bf24a55a-ff90-4e1a-9d3d-f90ea4c494c7" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="separator">newline</ac:parameter>
<ac:parameter ac:name="">content:title > text:split with - > collection:3</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>
<p class="auto-cursor-target">
<br/>
</p>
<p class="auto-cursor-target">
<br/>
</p>
Macro structure
You can recreate the example in the editor view:
Steps
Create a new page named "Employee Directory".
Create children pages under Employee Directory with this format: "Employee Name - Department - Date".
In the "Employee Directory" page, create a Report Table macro.
Within the Report Table, create a Content Reporter. Set the following parameters:
Space:Â "@self"
Types: "pages"
Scope:Â "Employee Directory > children"
Within the Content Reporter macro, create a Text Filter macro. Set the following parameters:
Key:Â "title"
Within the Report Table macro create a Report Column macro and set the following parameters:
Title:Â "Employee Name"
Within Report Column macro, create a Report Info macro. Set the following parameters:
Key:Â "content:title > text:split with - > collection:1"
Link to Item: Set to "checked".
Within Report Table macro, create another Report Column macro and set the following parameters:
Title:Â "Department"
Within Report Column macro, create a Report Info macro. Set the following parameters:
Key:Â "content:title > text:split with - > collection:2"
Link to Item:Â unchecked
Within Report Table macro, create the third Report Column macro and set the following parameters:
Title:Â "Date Joined"
Within Report Column macro, create a Report Info macro. Set the following parameters:
Key:Â "content:title > text:split with - > collection:3"
Link to Item: unchecked
Click Save and publish the page.