Show maps based on addresses in Scaffolding fields

Scenario

This recipe shows you how to embed Google Maps in a Confluence page using address or coordinate data stored in Scaffolding.

This recipe also requires the third-party app Embed Google Map. With the Embed Google Map macro you are able to create maps by entering an address in the Address or coordinates parameter.

Reporting is used to directly inject Scaffolding values into Embed Google Map's Address or coordinates parameter.

If you already have address or coordinate data stored in Scaffolding, this avoids having to manually enter the data into the Address or coordinates parameter.

Result

Recipe

Apps

Scaffolding Forms & Templates, Reporting for Confluence Server & Data Center, Embed Google Map

Apps

Scaffolding Forms & Templates, Reporting for Confluence Server & Data Center, Embed Google Map

Level

Advanced

Estimated time

45 minutes

Macros

Local Reporter, Report Column, Report Info, Report Table

Suppliers

Scaffold Data Supplier

Storage format

You can copy and paste this code into the Confluence Source Editor:

<p> <br /> </p> <ac:structured-macro ac:macro-id="8930a668-41fa-49cf-bae2-fdf18093c947" 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="56a8db81-f5c4-4d07-b270-8bb520df1142" ac:name="repeating-data" ac:schema-version="1"> <ac:parameter ac:name="name">Addresses</ac:parameter> <ac:rich-text-body> <p class="auto-cursor-target"> <br /> </p> <table class="wrapped relative-table" style="width: 42.0696%;"> <colgroup> <col style="width: 17.1824%;" /> <col style="width: 82.9561%;" /> </colgroup> <tbody> <tr> <th>Enter the location</th> <td> <div class="content-wrapper"> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="8cec1332-3790-481d-a1c2-7def4f9669ce" ac:name="text-data" ac:schema-version="1"> <ac:parameter ac:name="name">address</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> </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> <p> <br /> </p> <p> <br /> </p> <ac:structured-macro ac:macro-id="944be615-bf44-4722-8b90-296307bbb4a9" 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="391be3bf-7fee-4a3f-b09a-483401d64922" ac:name="local-reporter" ac:schema-version="1"> <ac:parameter ac:name="">data:Addresses</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="99ffa5a3-e523-4a2c-9796-2729fa9b108c" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="title">Address</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="df525212-aa9d-45cd-bdaf-2d451a9f6d86" ac:name="report-info" ac:schema-version="1"> <ac:parameter ac:name="">data:address</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="41cfb2f8-92d4-4ee9-8973-f74eb5a56096" ac:name="report-column" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="title">Map</ac:parameter> <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id="3aa442e5-883c-4c04-854a-3ecf3eea858f" ac:name="google-map" ac:schema-version="1"> <ac:parameter ac:name="border_style">none</ac:parameter> <ac:parameter ac:name="address">%data:address%</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>

 

Macro structure

You can recreate the example in the editor view:

Steps

  1. Add a Hidden Data macro.

  2. Within the Hidden Data macro, add a Repeating Data macro.
    Set its Name parameter to "Addresses".

  3. Within the Repeating Data macro, add a 2 x 2 table.

  4. In the first column, write "Enter the location".

  5. In the second column, add a Text Data macro.
    Set its Name parameter to "address" and its Content Type parameter to "text".

  6. Under the Hidden Data macro, add a Report Table macro.

  7. Within the Report Table macro, add a Local Reporter macro and two Report Column macros.
    Set the Local Reporter macro's Key as "data:Addresses".

  8. Set the first Report Column macro's Title to "Address" and add a Report Info macro within it.
    Set the Report Info macro's Key to "data:address".

  9. Set the second Report Column macro's Title to "Map".
    Set Injected parameter to "true".

  10. Add a Google Map macro within the second Report Column macro.
    Set its Address or coordinates parameter to "%data:address%".