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

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 &gt; 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 &gt; text:split with - &gt; 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 &gt; text:split with - &gt; 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 &gt; text:split with - &gt; 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

  1. Create a new page named "Employee Directory".

  2. Create children pages under Employee Directory with this format: "Employee Name - Department - Date".

  3. In the "Employee Directory" page, create a Report Table macro.

  4. Within the Report Table, create a Content Reporter. Set the following parameters:

    1. Space: "@self"

    2. Types: "pages"

    3. Scope: "Employee Directory > children"

  5. Within the Content Reporter macro, create a Text Filter macro. Set the following parameters:

    1. Key: "title"

  6. Within the Report Table macro create a Report Column macro and set the following parameters:

    1. Title: "Employee Name"

  7. Within Report Column macro, create a Report Info macro. Set the following parameters:

    1. Key: "content:title > text:split with - > collection:1"

    2. Link to Item: Set to "checked".

  8. Within Report Table macro, create another Report Column macro and set the following parameters:

    1. Title: "Department"

  9. Within Report Column macro, create a Report Info macro. Set the following parameters:

    1. Key: "content:title > text:split with - > collection:2"

    2. Link to Item: unchecked

  10. Within Report Table macro, create the third Report Column macro and set the following parameters:

    1. Title: "Date Joined"

  11. Within Report Column macro, create a Report Info macro. Set the following parameters:

    1. Key: "content:title > text:split with - > collection:3"

    2. Link to Item: unchecked

  12. Click Save and publish the page.