---
title: "How to retrieve attachments based on labels using Run macro"
canonical: "https://support.appfire.com/space/SUPPORT/89140774/How%20to%20retrieve%20attachments%20based%20on%20labels%20using%20Run%20macro"
format: markdown
---
<span style="color: #000000">This article explains how to input data using a form and retrieve attachments into a Confluence page based on attachment labels using the </span>*<span style="color: #000000">Run Self-Service Reports for Confluence</span>*<span style="color: #000000"> and </span>*<span style="color: #000000">Advanced Table for Confluence </span>*<span style="color: #000000">apps.</span>

## <span style="color: #000000">Instructions</span>

1. <span style="color: #000000">In a Confluence page, insert a </span>*<span style="color: #000000">Run with a user form and parameters </span>*<span style="color: #000000">macro.</span>
2. <span style="color: #000000">Insert an </span>*<span style="color: #000000">Attachment Table </span>*<span style="color: #000000">macro i</span><span style="color: #000000">nside the </span>*<span style="color: #000000">Run</span>*<span style="color: #000000"> macro</span><span style="color: #000000">.</span>  
> Macro (inline-media-image)
3. <span style="color: #000000">Edit the </span>*<span style="color: #000000">Attachment</span>*<span style="color: #000000"> macro and perform the following:</span>
  1. <span style="color: #000000">Select the relevant filtering options for the </span>*<span style="color: #000000">Source</span>*<span style="color: #000000">, </span>*<span style="color: #000000">Space</span>*<span style="color: #000000">, and </span>*<span style="color: #000000">Page</span>*<span style="color: #000000"> parameters. In this example, the </span>*<span style="color: #000000">Single page</span>*<span style="color: #000000">, </span>*<span style="color: #000000">Current space,</span>*<span style="color: #000000"> and </span>*<span style="color: #000000">Current page</span>*<span style="color: #000000"> options are selected for the </span><span style="color: #000000">respective </span><span style="color: #000000">parameters.</span>  
> Macro (inline-media-image)
  2. <span style="color: #000000">Enter </span>*<span style="color: #000000">$LABEL </span>*<span style="color: #000000">in </span>*<span style="color: #000000">Attachment label regex</span>**<span style="color: #000000"> </span>*<span style="color: #000000">under the </span>*<span style="color: #000000">Attachment filtering </span>*<span style="color: #000000">tab and </span>**<span style="color: #000000">Save</span>**<span style="color: #000000"> the macro</span><span style="color: #000000">*.*</span>  
> Macro (inline-media-image)
4. <span style="color: #000000">Edit the </span>*<span style="color: #000000">Run with a user form and parameters </span>*<span style="color: #000000">macro and do as follows:</span>
  1. <span style="color: #000000">Click </span>**<span style="color: #000000">Add my first field</span>**<span style="color: #000000"> in </span>*<span style="color: #000000">Field settings</span>*<span style="color: #000000">.</span>  
> Macro (inline-media-image)
  2. <span style="color: #000000">Select the desired </span>*<span style="color: #000000">Field Type</span>*<span style="color: #000000"> and add </span>*<span style="color: #000000">LABEL </span>*<span style="color: #000000">in </span><span style="color: #000000">*Field key.*</span>  
> Macro (inline-media-image)
5. <span style="color: #000000">Save the changes and publish the page.</span>
6. <span style="color: #000000">Enter the required label to be retrieved and click </span>**<span style="color: #000000">Run. </span>**<span style="color: #000000">Results are shown as per the given label available for the attachments on the specified page. In this example, the output is as shown:</span>  
> Macro (inline-media-image)

> ℹ️ <span style="color: #000000"> The </span>**<span style="color: #000000">$</span>**<span style="color: #000000"> immediately followed by a </span>*<span style="color: #000000">Field key</span>*<span style="color: #000000"> (in this case, </span><span style="color: #000000">LABEL</span><span style="color: #000000">) from the </span>*<span style="color: #000000">Run with a user form and parameters</span>*<span style="color: #000000"> macro is replaced by the values provided in the form.</span>