combine metadata and local-reporter macro
Asked by Michal Zebrowski:

Hello,

I have a parent page and a set of children pages with metadata f.e.:

```
{metadata:SEC}IK1{metadata}{metadata:SEC}IK2{metadata}{metadata:SEC}IK5{metadata}{metadata:SEC}IK10{metadata}and so on
```

now, what I want to do is to list all metadata from children pages on parent page using local-reporter macro.

I tried something like this:

```
{metadata-from:{report-info:content:title|link=false}|NAME}
```

but that doesnt work

In other words: I dont know how to inject a current page name to {metadata-from} macro.


Answers:
author: David Peterson
body: Try the reverse - get the metadata value via {report-info}. Metadata comes with a Supplier to allow retrieval via the Reporting Plugin. So, this should work:

{report-info:metadata:NAME}

Hopefully. :)

comments: author: Michal Zebrowski
body: That's exactly what I'm looking for. However it doesn't work for me. More details below.

I have three pages - Two child pages named 'Meta child page 1' and 'Meta child page 2' and parent page named 'Meta parent page'. Child pages have "metatest" label.

Meta child page 1 code:

```
{metadata:Sec}IK1{metadata}{excerpt}Excerpt from Meta child page 1{excerpt}
```

Meta child page 2 code:

```
{metadata:Sec}IK15{metadata}{excerpt}Excerpt from Meta child page 2{excerpt}
```

Meta parent page code:

```
{metadata-from:Meta child page 1|Sec}{metadata-from:Meta child page 2|Sec}{report-table}{content-reporter:types=page|labels=+metatest}{content-reporter}{report-column:title=Page}{report-info:title|link=true}{report-column}{report-column:title=Metatest}{report-info:metadata:Sec}{report-column}{report-column:title=Excerpt (column header)}{report-info:excerpt|link=true|render=wiki}{report-column}{report-table}
```

And that's what I get (see image)

![](http://img834.imageshack.us/img834/5827/metadataoutput.jpg)

Metadata is not visible, when I use reporter macro. I don't know where is the problem.

metadata plugin is v. 2.1.0 and reporter plugin is v. 3.4.2


author: Martin Moser
body: Not quite sure I understand your question, but have you tried something like this:

{metadata-report:Page,SEC\|key=YOURSPACEKEY\|root=@self\|pages=@descendants\|maxResults=1000\|sort=Page}

If you need to filter further you could do so using

labels=label1,label2

(See <https://studio.plugins.atlassian.com/wiki/display/META/Metadata+plugin+version+1+documentation> for more information about metadata-reports)

comments: author: Michal Zebrowski
body: Thx.

Do You know how to get an excerpt from the page using this macro?

I tried:

```
metadata-report:Sec,Page,Excerpt|key=TEST|root=@self|pages=@descendants|maxResults=1000|sort=Page|style=list}
```

where Sec is metadata's name, but it only lists metadata's value and link to the page. Excerpt is not visible.


author: Martin Moser
body: Hi Pecet,

never used Excerpt - it is listed under additional internal metadata at <https://studio.plugins.atlassian.com/wiki/display/META/Confluence+Metadata+Plugin#ConfluenceMetadataPlugin-Additionalinternalmetadata> but apparently it isn't really working, at least not for me (just tried it out myself) :-(

... or I'm doing something wrong ...


author: Martin Moser
body: Of course as a workaround one could always just simply define {metadata:Excerpt} and use that ...


author: David Peterson
body: I'm not sure exactly what the Metadata supplier details are unfortunately. However, you should be able to use Metadata's own standard display macros if you want - just don't specify the source location. Reporting renders reports in the context of the page they are reporting on, so as far as the metadata macro is concerned, it is executing on the original page.

comments: author: Michal Zebrowski
body: Looks like I need metadata plugin is v. 2.1.3 at least.

Thx for all answers.


author: Thomas Wendel
body: Hi Pecet,  

Sorry, but what exactly do you want to achieve?  

You got child-pages and each one of them has metadata on it (e.g. the first one hast {metadata:SEC}IK1{metadata}, the second one {metadata:SEC}IK2{metadata}, etc.)?  
And on the parent page you want a list of all child-pages with their metadata?  

Please clarify a bit.  

Cheers,  
Thomas


Tags: local-reporter

metadata