Calculating Work Hours in a Day
Scenario
By combining Reporting and Visibility, you are able to create forms that can take your input data and perform calculations and then output the results.Â
For example, this recipe allows you to create a table that is able to list specific work hours by project per day minus time taken for lunch breaks.
Result
Recipe
Apps | Reporting for Confluence Server & Data Center, Scaffolding Forms & Templates for Confluence Server and Data Center, Visibility for Confluence |
---|---|
Level | Intermediate |
Estimated time | 30 minutes |
Macros | Local Reporter, Report Column, Report Eval, Report Info, Report Table |
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="72119840-4d11-418b-9382-d3f007594c82" ac:name="show-if" ac:schema-version="1">
<ac:parameter ac:name="action">edit</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="04228489-4cce-49ed-bf87-18d1223b08bb" ac:name="table-data" ac:schema-version="1">
<ac:parameter ac:name="name">project</ac:parameter>
<ac:parameter ac:name="initialRows">1</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br />
</p>
<table class="wrapped">
<colgroup>
<col />
<col />
<col />
<col />
<col />
</colgroup>
<tbody>
<tr>
<th>
<p>Job</p>
</th>
<th>
<p>Start</p>
</th>
<th>
<p>End</p>
</th>
<th>
<p>Lunch Break</p>
</th>
<th>
<p>Comments</p>
</th>
</tr>
<tr>
<td>
<div class="content-wrapper">
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="e2e718db-b10d-4ef3-92c7-f1502b308b43" ac:name="text-data" ac:schema-version="1">
<ac:parameter ac:name="name">job</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>
</div>
</td>
<td>
<div class="content-wrapper">
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="5f359016-ef08-49a8-85ed-03d563415414" ac:name="date-data" ac:schema-version="1">
<ac:parameter ac:name="format">dd/MM/yyyy HH:mm</ac:parameter>
<ac:parameter ac:name="name">start</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:plain-text-body><![CDATA[ today]]></ac:plain-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
</div>
</td>
<td>
<div class="content-wrapper">
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="a9f84028-50a2-492e-9927-e3dbe52aebdb" ac:name="date-data" ac:schema-version="1">
<ac:parameter ac:name="format">dd/MM/yyyy HH:mm</ac:parameter>
<ac:parameter ac:name="name">end</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:plain-text-body><![CDATA[ today]]></ac:plain-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
</div>
</td>
<td>
<div class="content-wrapper">
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="a0a12699-1d23-42d2-9944-da20a8439691" ac:name="list-data" ac:schema-version="1">
<ac:parameter ac:name="blank">false</ac:parameter>
<ac:parameter ac:name="name">break</ac:parameter>
<ac:parameter ac:name="required">true</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="964902da-ffdb-49bf-8cff-5f791eacfe50" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">10</ac:parameter>
<ac:parameter ac:name="value">10</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="6ee5bb57-7dfb-48bb-bd2e-ba522cd4a150" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">15</ac:parameter>
<ac:parameter ac:name="value">15</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="5f120bb9-840c-40d8-b8fb-aebd2519fef9" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">20</ac:parameter>
<ac:parameter ac:name="value">20</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="942d911e-65bd-4d5b-bd4b-0f82683512f2" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">25</ac:parameter>
<ac:parameter ac:name="value">25</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="8dbcadb0-b079-4e3b-bc5d-8d4d58e29a18" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">30</ac:parameter>
<ac:parameter ac:name="value">30</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="6cdcf37a-879b-4ea0-a421-b45607fa62bd" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">35</ac:parameter>
<ac:parameter ac:name="value">35</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="392d3871-82a9-4ce5-95b0-51d5e0ef6bde" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">40</ac:parameter>
<ac:parameter ac:name="value">40</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="544c866b-242f-484f-898d-c2e61f5a3d4a" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">45</ac:parameter>
<ac:parameter ac:name="value">45</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="605fff07-4760-4c66-8525-1f0edc701ca9" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">50</ac:parameter>
<ac:parameter ac:name="value">50</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="2aa95bbe-dc25-4d6b-bffd-9bfa7167fa24" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">55</ac:parameter>
<ac:parameter ac:name="value">55</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="137e3953-16e2-4c9c-99b3-bcd355c3086f" ac:name="list-option" ac:schema-version="1">
<ac:parameter ac:name="label">60</ac:parameter>
<ac:parameter ac:name="value">60</ac:parameter>
<ac:rich-text-body>
<p>
<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>
</div>
</td>
<td>
<div class="content-wrapper">
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="5320d0a6-fcd1-4e78-9d3b-0380a6cc85b6" ac:name="text-data" ac:schema-version="1">
<ac:parameter ac:name="name">comments</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>
</div>
</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>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="00e9341c-a9f9-4d1c-aad3-36f7f95af19f" ac:name="show-if" ac:schema-version="1">
<ac:parameter ac:name="action">view</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="f7ff091a-6a9b-4212-9e95-3fb1990a4c49" 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="cf128504-9e1f-4600-aabc-830a9d82ff05" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="">data:project</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="79baaa12-0301-45be-aa1d-8249b8270e7d" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Job</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="3968768c-38c2-4006-b08b-3bffc3c920db" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="render">richtext</ac:parameter>
<ac:parameter ac:name="rendr">richtext</ac:parameter>
<ac:parameter ac:name="">data:job</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="e46c825a-5523-4e32-83ec-6b1d1e172d60" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Start</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="d7f6b80b-26e9-4d54-83da-2b598d462cab" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="format">dd/MM/yyyy HH:mm</ac:parameter>
<ac:parameter ac:name="">data:start</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="bf6d10c0-eb70-4bdb-bfb5-0e57645e71f4" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">End</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="4d809822-2e15-4ba8-8d4d-33d2916e8a82" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="format">dd/MM/yyyy HH:mm</ac:parameter>
<ac:parameter ac:name="">data:end</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="a38623d3-f459-4058-9958-a061dfbf8c5a" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Lunch Break</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="e5649846-a788-4634-adf9-6ceccab961ef" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">data:break</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="4766b406-142b-4daa-8b64-9c8e2cf9f0bc" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Comments</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="e1edfb7f-03f4-450c-a8c5-4f4175f85ef5" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="render">richtext</ac:parameter>
<ac:parameter ac:name="">data:comments</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="2e812284-770f-4729-8d7a-e70b9fbc8509" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Total Work Hours</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="c8799d58-0eae-4376-ba3a-162d5e7804be" ac:name="report-eval" ac:schema-version="1">
<ac:parameter ac:name="format">#0.00</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:parameter ac:name="">test2</ac:parameter>
<ac:plain-text-body><![CDATA[((%data:end > date:milliseconds% - %data:start > date:milliseconds%) - (%data:break > collection:first > text:as number%) * 60 * 1000) / (1000 * 60 * 60 )]]></ac:plain-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