How do I filter with the attachment maacro using a label?
Asked by Terry:

I am loading a number of documents which I will assign different labels (e.g. Minutes, Agendas, Plans, Requirements). I want to create a page that I can then put mutliple Attachemnt Macro and have each display only the documents that correspond to the label I assign a document.

So in the Minute Attachemnts only documents labeled "Minutes" will show, and so forth.

I have edited the file property to add the appropriate label but my pilot document is only showing in the attachment with No label assigned even though it show a label of Minutes.

Is this even possible in Confluence? If so How? Longing for my metadata in SharePoint!


Answers:
author: Fabienne Gerhard
body: Hi [@Terry](/t5/user/viewprofilepage/user-id/1639807) - are the attachments you will show part of the same page where you put the macro in? If not - you have to put the page title in page field where system can find the labeled attachments

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28472iB0D239DBACEC5123/image-dimensions/513x90?v=v2 "grafik.png")

comments: author: Terry
body: Fabienne,

After I load the Attachment Macro and publish the page section I then drag and drop the document to the space provided. I then add the label to the document. I am new to JIRA and Confluence so I maybe asking for them to do things that they are not designed to do. Just not able to find instructions in doing what I am desiring to do in the tools.


author: Fabienne Gerhard
body: Hi [@Terry](/t5/user/viewprofilepage/user-id/1639807) - did you put labels to the attachments?

You have to name the labels in the label field when editing attachment macro

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28505i0BADB93E87C5AE2D/image-dimensions/538x328?v=v2 "grafik.png")


author: Fabienne Gerhard
body: Your attachment site would look like this

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28507i6D885F7B9B6C8CD1/image-size/large?v=v2&px=999 "grafik.png")


author: Fabienne Gerhard
body: and on the site it would look like this with 3 attachment macros sorted by different labels

Edit mode:

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28508i5373C0D2AD305515/image-dimensions/563x96?v=v2 "grafik.png")

Published:

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28509i05E9482AB0A12BB1/image-size/large?v=v2&px=999 "grafik.png")


author: Terry
body: Fabienne,

I have done those steps and it does not work.

I load and define the Attachment Macro.

![2018-08-02_Attachment control.png](https://community.atlassian.com/t5/image/serverpage/image-id/28516i84EBC7FC3693DC49/image-dimensions/528x323?v=v2 "2018-08-02_Attachment control.png")

![2018-08-02_Minutes_Page_Showing_Attachment_Control.png](https://community.atlassian.com/t5/image/serverpage/image-id/28517i7D3274527FD1C116/image-dimensions/529x269?v=v2 "2018-08-02_Minutes_Page_Showing_Attachment_Control.png")

I then Publish the page.

![2018-08-02_Minutes_Page_After_publishing.png](https://community.atlassian.com/t5/image/serverpage/image-id/28518i4EE637362C95D26B/image-dimensions/463x248?v=v2 "2018-08-02_Minutes_Page_After_publishing.png")

Today I cannot load a document at all. Yesterday when I loaded the file would show up in each box no matter which I loaded it into. I added the label to the document after loading it to the section.

I noticed that you have "display" coded. Is that necessary?

I also notice that there is a similar thread out there

<https://community.atlassian.com/t5/Jira-questions/Just-show-some-labels-in-filter-results/qaq-p/748021>


author: Fabienne Gerhard
body: Did you tag the attachments with the labels on your attachment site? System can only sort by the defined label of your macro if it can find the labeled attachment on the definded site.

You should also see the labeled attachments (my 2nd pic on the previous post) when editing the macro and click on preview.

![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/28533i771157CDA903E4F5/image-dimensions/556x342?v=v2 "grafik.png")


author: Terry
body: Yes, I have the document labeled. ![2018-08-02_Attachment_List.png](https://community.atlassian.com/t5/image/serverpage/image-id/28534iED8D92D290B6A946/image-dimensions/560x248?v=v2 "2018-08-02_Attachment_List.png")


author: Fabienne Gerhard
body: Hmm, that's weird - your Screenshot shows that it's on the same page, label is the same...

Last thing I can imagine - you sorted by AOCT in the macro, all in uppercases - but label is in lower case letters. I've tried that and this did'nt work. Try using lower case letters - aoct.

Hope this helps!


author: Terry
body: Fabienne,

That toke care of the issue. The document now only shows up in the right list.

![2018-08-03_Minutes_Page_After_publishing.png](https://community.atlassian.com/t5/image/serverpage/image-id/28639i40910B0ACA18B6BF/image-dimensions/472x268?v=v2 "2018-08-03_Minutes_Page_After_publishing.png")


author: Fabienne Gerhard
body: Great - hope that solved the whole problem!


author: Terry
body: Fabienne,

Yes, everything is good now.

Thanks again for hanging in there with me on this.