Creating an IF ELSE statement with Reporting

Scenario

This recipe allows you to create an IF ELSE statement using Reporting and Scaffolding Forms & Templates for Confluence Server and Data Center instead of using reporting data via the Report Body and Report Empty macros.

This also replaces the legacy report structure where you place text filter macros into Report Body or Report Column.

Result

Recipe

Apps

Scaffolding Forms & Templates for Confluence Server and Data Center, Reporting for Confluence Server & Data Center

Apps

Scaffolding Forms & Templates for Confluence Server and Data Center, Reporting for Confluence Server & Data Center

Level

Advanced

Estimated time

30 minutes

Macros

Local Reporter, Report Block, Report Body, Report Column, Report Info, Report Table, Text Filter

Suppliers

Scaffold Data 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="64391ff8-0d58-4b9f-afaf-7d7d36a08b47" ac:name="hidden-data" 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="0022dcfb-82a6-4120-93a2-09eff255f04a" ac:name="table-data" ac:schema-version="1"> <ac:parameter ac:name="name">mytable</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <table> <tbody> <tr> <th> <p>Title</p> </th> <th> <p>Status</p> </th> </tr> <tr> <td> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="64f7715e-e0cf-4b65-87ec-3a9eb4373d8e" ac:name="text-data" ac:schema-version="1"> <ac:parameter ac:name="name">mytitle</ac:parameter> <ac:parameter ac:name="type">line</ac:parameter> <ac:parameter ac:name="content">text</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </td> <td> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="850c3f36-e248-46c3-bf2a-d0490e2bd41d" ac:name="list-data" ac:schema-version="1"> <ac:parameter ac:name="name">mystatus</ac:parameter> <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="2a74714e-fa90-434b-b5ae-768eeebfb2d5" ac:name="list-option" ac:schema-version="1"> <ac:parameter ac:name="value">Approved</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="d62f9782-960d-4398-bf5d-f43c64fcb8cf" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">green</ac:parameter> <ac:parameter ac:name="title">Approved</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="cd26b663-f7a7-4646-bf14-a9b5161bd258" ac:name="list-option" ac:schema-version="1"> <ac:parameter ac:name="value">Rejected</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="a51b416e-4ff4-45e2-85ee-34e1add74064" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">red</ac:parameter> <ac:parameter ac:name="title">Rejected</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="422eee78-d0c5-48ad-a8b4-7181a11bd2ac" ac:name="list-option" ac:schema-version="1"> <ac:parameter ac:name="value">In Progress</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="301603e4-73f5-4fbb-9c4d-ef0a875dd4d4" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">yellow</ac:parameter> <ac:parameter ac:name="title">In Progress</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="ea824718-a4b8-4b39-99c6-d8e033949bf8" ac:name="list-option" ac:schema-version="1"> <ac:parameter ac:name="value">Unassigned</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="05cea2f5-98a7-48d4-884d-a89b07a182c2" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">grey</ac:parameter> <ac:parameter ac:name="title">Unassigned</ac:parameter> </ac:structured-macro> </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> </td> </tr> </tbody> </table> <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> <hr /> <h3>Method 1:</h3> <ac:structured-macro ac:macro-id="4fdc5621-8cb5-430a-93d2-c45566413355" 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="7da805b6-6c84-4250-88f5-649e50426735" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="source">@self</ac:parameter> <ac:parameter ac:name="">data:mytable</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="fd45bb09-3559-43e2-a68e-08e23ddaf11d" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Title</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="45082d44-e4f5-46c8-8dad-51217b623407" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">data:mytitle</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="f98fefb0-96e9-40ad-b422-7d74d9c329f0" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Status</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="0ec9408a-553c-4bf4-a0c8-77e367d98cb3" 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="432a5ff9-2cb5-498b-b7e7-cb9e68506828" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">data:mystatus &gt; collection:first &gt; text:find Approved</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="ed7a3a3d-4965-48ad-b8fb-0c8362c7693a" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="0f17a501-4102-4216-ac9a-eb650d051704" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">green</ac:parameter> <ac:parameter ac:name="title">Approved</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="644b601d-2db4-42b2-a300-e92ebded50c5" 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="ae5e737f-5beb-4f20-ad84-a0c68fa45900" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">data:mystatus &gt; collection:first &gt; text:find Rejected</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="d8816740-527c-496b-952b-17a68094ff8b" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="a20735f0-1bdc-45a4-915a-8d0a496afce1" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">red</ac:parameter> <ac:parameter ac:name="title">Rejected</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="e333045e-b8ab-4876-9d5a-f87cbf388021" 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="c884ac52-d7f6-43a5-9d52-8700613dd25c" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">data:mystatus &gt; collection:first &gt; text:find In Progress</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="d9c78e2d-7f8e-4731-97d8-40d5e72d2eb4" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="2784c410-4ebc-4e1e-8226-7439d163bee0" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">yellow</ac:parameter> <ac:parameter ac:name="title">In Progress</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="87adef73-90c3-4333-b1ad-c50cea3a9c9d" 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="16856858-4ae9-47c6-90b0-01248afecbb0" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">data:mystatus &gt; collection:first &gt; text:find Unassigned</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="e8d06039-32dc-4b95-89df-53ebefedc119" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="30bf0f7e-87e4-48ec-94a0-5b5cef9ec121" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">grey</ac:parameter> <ac:parameter ac:name="title">Unassigned</ac:parameter> </ac:structured-macro> </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"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <hr /> <h3>Method 2:</h3> <ac:structured-macro ac:macro-id="485be0b3-49d9-44d0-9703-240f31c4aaa3" 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="2ebbf8da-c12e-41eb-981b-37b16eec1b86" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="source">@self</ac:parameter> <ac:parameter ac:name="">data:mytable</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="a26f3205-ed4f-4aa2-aa60-81f94fde9409" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Title</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="be76f63a-cb40-4956-aac6-e8abed13d7e0" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">data:mytitle</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="fb8e39c2-3620-4f70-9ee2-1a6bc07d417a" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Status</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="aa92bad9-edfa-4e4f-bdd0-d7db14c4b6f3" 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="176cffab-744c-45e9-bcc6-b211457f777b" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">@self</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="12cac7c6-8f28-4589-843b-f89a4bab1ed0" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">.*Approved.*</ac:parameter> <ac:parameter ac:name="">data:mystatus</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="527c7c66-faff-4863-ae9c-e2f03b3ed491" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="e15c4b5d-b1ce-46da-9279-549b54db9123" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">green</ac:parameter> <ac:parameter ac:name="title">Approved</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="421181a5-c259-4351-b8ec-22767f3cc2c5" 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="7982629e-02c0-474a-805c-01d47b02567c" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">@self</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="525efb4b-429e-4a17-b0a2-7f16c746a898" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">.*Rejected.*</ac:parameter> <ac:parameter ac:name="">data:mystatus</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="f0a27872-dd1a-4883-9452-87cdf875fbca" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="46980c33-6c89-4d84-b066-f83ab9f99d30" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">red</ac:parameter> <ac:parameter ac:name="title">Rejected</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="dc958f7e-3f83-4de9-8956-95ff6ddb8b59" 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="cb1f3108-5978-47ba-9b33-4e3d2be7fa8c" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">@self</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="aab1f263-d01e-4291-bf18-0cefc3be128e" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">.*In Progress.*</ac:parameter> <ac:parameter ac:name="">data:mystatus</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="50371917-726e-4436-8647-c079ed9eb21d" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="4dad56ad-7ea1-4ade-807b-9d58cf90df8b" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">yellow</ac:parameter> <ac:parameter ac:name="title">In Progress</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> </p> <ac:structured-macro ac:macro-id="7ef00e1f-ba24-4aac-9c00-f909d4856e4c" 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="635d4f1d-917d-406e-83ea-ddb2f6d53ec7" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">@self</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="82be5656-d3fe-4622-8bac-d206728a7faf" ac:name="text-filter" ac:schema-version="1"> <ac:parameter ac:name="include">.*Unassigned.*</ac:parameter> <ac:parameter ac:name="">data:mystatus</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="eecc3656-e33e-4ff5-8539-e2a9b0ad9153" ac:name="report-body" ac:schema-version="1"> <ac:rich-text-body> <ac:structured-macro ac:macro-id="9e01eddc-5d65-40d9-bc8d-524f180a4eaf" ac:name="status" ac:schema-version="1"> <ac:parameter ac:name="color">grey</ac:parameter> <ac:parameter ac:name="title">Unassigned</ac:parameter> </ac:structured-macro> </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"> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p>

 

Macro structure

You can recreate the example in the editor view:

 

 

Steps

  • N/A

Line-by-Line Explanation

  • N/A