Extract values from page titles using the Text supplier
Scenario
This recipe will help you to extract certain values from page titles and then show them in different columns using the Text Supplier macro.
In this example, we use the Page Supplier and Text Supplier macros to extract a number from page titles.
Result
Recipe
Apps | Reporting for Confluence Data Center, Linking for Confluence Data Center |
|---|---|
Level | Easy |
Estimated time | 10 minutes |
Macros | Local Reporter, Report Column, Report Info, Report Table |
Suppliers | Page Supplier, Text Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<p>Create a Child Page: <ac:structured-macro ac:macro-id="164092d7-53b7-498c-986f-16b720d77dea" ac:name="add-page" ac:schema-version="1">
<ac:parameter ac:name="name">Child Page %child-counter:next > number:000%</ac:parameter>
<ac:parameter ac:name="linkText">Create Child Page</ac:parameter>
</ac:structured-macro>
</p>
<hr />
<p>List of Children Pages:</p>
<ac:structured-macro ac:macro-id="ac02fa1e-1f5c-48ed-a2de-cb2cb25f3520" ac:name="report-table" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="77342fca-1f4e-4496-b49c-a07c622b1dd7" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="">page:children</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="7ae77974-2eff-4c97-8cd3-ac9634aad176" ac:name="text-sort" ac:schema-version="1">
<ac:parameter ac:name="">page:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="1c053104-056e-444c-8bb6-f8eaac8a51e7" 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="ea25a2f0-ffe4-4a47-8085-f7f3ede8bf93" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">page:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="22b23480-5cbe-4441-907c-fe1fc6a00bae" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Page Number (Extracted from Page Title)</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="f12c0810-c0ce-4495-84c0-d29b140a80bb" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">page:title>text:last 3>text:as number</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
Macro structure
You can recreate the example in the editor view:
Steps
Create a page and child pages with titles that have a format of
Child Page <000>.
You can use the Add Page macro from Linking for Confluence to create the child pages with a running number.
Insert an Add Page macro to the top of the page and and set the following:
Name:
Child Page %child-counter:next > number:000%Link Text:
Create a Child Page
Add a Report Table macro and within it, add a Local Reporter macro with the Key parameter set to
page:children.Within the Local Reporter macro, add a Text Sort macro and set the Key to
page:title.Under the Local Reporter macro, add a Report Column macro with Title set to
Page Title.Within the Page Title Report Column macro, add a Report Info macro with Key set to
page:titleand Link to item selected.Under the Page Title Report Column macro, add another Report Column macro with Title set to
Page Number.Within the Page Number Report Column macro, add a Report Info macro with Key set to
page:title>text:last 3>text:as number.