how can I build a report for value = ?
Asked by Jonathan Dingman:

So I have metadata on a page, but I'm trying to figure out how I can build a report against a specific value.

ie if the column is "day", and there are values of friday, friday, friday, thursday, wednesday

how can I build a report for all the rows that have day = friday?


Answers:
author: David Peterson
body: I'm a little hazy on the exact Supplier that Metadata provides, but you should be able to do something like this:

{report-table}

{local-reporter:page:descendents}

{text-filter:metadata:AB\|value=AB}

{text-sort:page:title}

{local-reporter}

{report-column:title=Page}{report-info:page:title\|link=true}{report-column}

{report-column:title=Application}{report-info:metadata:Application}{report-column}

{report-column:title=Component}{report-info:metadata:Component}{report-column}

etc...

{report-table}

You can add more filters and sort values inside the {local-reporter} to customise your query. If you use Scaffolding data fields instead, you can specify formatting for date and number fields. Just substitute "data:My Field Name" into the above, and provide a 'format' rule to display them. Eg, for creation date it might be:

{report-info:data:Creation Date\|format=d MMMM, yyyy}

Which would output something like "29 September, 2011".

Hope that helps!

comments: author: Jonathan Dingman
body: Thanks David

I tested that, and it's returning the actual scaffolding data, not the values I put in.

ie when I specify for Application, it's returning this value:

{text-data:Application2\|width=600px\|height=50px\|type=area}WM, WMPB .. etc etc

Any idea how I can get around that?  


author: David Peterson
body: I would suggest using the actual 'Application2' value then. That is:

{report-info:data:Application2\|render=wiki}

That will return the contents of the Scaffold field, rather than the metadata field which contains the Scaffold {text-data} markup.


author: Jonathan Dingman
body: Great! That's one step closer to getting what I need.

Based on using the data: pre-fix, how should I use the text-filter to filter based on that data?

Can I use something like data:Application2\|include=WC where the metadata has WC somewhere in the data? (I want to be able to use include rather than just value=)

Thank you David!


author: Jonathan Dingman
body: Aha! I think I got it.

```
{text-filter:data:Application2|include=WC}
```

That should be sufficient. Thanks David


author: David Peterson
body: That would do the trick. If you want it to be a real 'contains WC', then add '.\*' before and after. Eg:

```
{text-filter:data:Application2|include=.*WC.*}
```


author: Jonathan Dingman
body: Great! That's definitely a huge help.

One more issue I'm running into.

{list-data:Component3\|type=check\|multiple=true}  
{list-option}Web{list-option}

It's not letting me grab the data if it's a list-option. Is there anything special, aside from :data:, that I have to use to grab those values?

Thanks for all your help David


author: David Peterson
body: {list-option} values are accessible as 'Text' objects (via the Text Supplier). However, in this case you have 'multiple=true', which means the result for 'data:Component3' is actually a Collection of Text values, so you need to work with the value as a collection. There are a couple of ways to do this. The simplest is {report-on}, and would look like this:

{report-on:data:Component3\|separator=comma}{report-info:@self}{report-on}


author: Jonathan Dingman
body: Thx!

Everything was working until I tried to use "descendants" .. only to find there was a small bug :)

<http://community.customware.net/customware/topics/local_reporter_children_works_but_descendants_doesnt>

I switched it to "descendents" and BAM! Everything is working great now.

Thanks for all your help David


author: David Peterson
body: Does depend on how you're storing your metadata (ie. with the Metadata Plugin or the Scaffolding Plugin?) and what you're reporting with. More details of your wiki markup would be helpful...

comments: author: Jonathan Dingman
body: I'm actually using both.

I'm using live-template to pull in the live template from the scaffolding plugin and inside the live-template, I'm wrapping the fields with metadata

that way each page with the template that I use, has the metadata

Here is an example of the reporting page I have on the metadata

{metadata-report:Page,Application,Component,Create Date,Fix Version,Author,Publisher\|root=Test Cases\|pages=@descendants}  
that pulls in the meta data that I'm using for each page. I'm trying to figure out how I can do something like...  
Component = AB


author: Kevin Buchs
body: ```
{text-filter:prefix:key|value="friday"} should do the trick for you.
```


Tags: metadata